ﻢﯿﻨﮐ ﺩﺎﺠﯾﺍ ﺱﺮﭘﺩﺭﻭ ﺦﺳﺎﭘ ﻭ ﺶﺳﺮﭘ ﻩﺩﺎﺳ ﻦﯿﮔﻼﭘ ﮏﯾ ﻪﻧﻮﮕﭼ
!ﺪﯿﻨﮐ ﺩﻮﺧ ﻝﺎﻣ ﺍﺭ ﻥﺁ ﻭ ﺪﯿﻨﮐ ﯽﺷﺭﺎﻔﺳ ﺍﺭ ﻝﻭﺍﺪﺘﻣ ﯼﺎﻫ ﺶﺳﺮﭘ ﺶﺨﺑ ﺪﯿﻧﺍﻮﺘﺑ ﺎﺗ ﺪﻫﺩ ﯽﻣ ﺶﺷﻮ
ﺪﯿﻨﮐ ﺩﺎﺠﯾﺍ ﺍﺭ ﻪﻧﻭﺰﻓﺍ :1 ﻪﻠﺣﺮﻣ
:ﺪﯿﻫﺩ ﺭﺍﺮﻗ ﺍﺭ ﺪﮐ ﻦﯾﺍ ﻭ ﺪﯿﻨﮐ ﺩﺎﺠﯾﺍ ”rc-faq.php“ ﻡﺎﻧ ﻪﺑ ﻪﺷﻮﭘ ﻦﯾﺍ ﺭﺩ ﺪﯾﺪﺟ ﻞﯾﺎﻓ ﮏﯾ
<?php
/*
Plugin Name: RC Faq
Plugin URL: http://remicorson.com/rc-faq
Description: A simple FAQ plugin
Version: 1.0
Author: Remi Corson
Author URI: http://remicorson.com
Contributors: corsonr
*/
ﺪﯿﻨﮐ ﺖﺒﺛ ﺍﺭ ﻝﻭﺍﺪﺘﻣ ﺕﻻﺍﺆﺳ ﯽﺷﺭﺎﻔﺳ ﺖﺴﭘ ﻉﻮﻧ :2 ﻪﻠﺣﺮﻣ
.ﺪﯿﻧﺰﺑ Codex ﻪﺑ ﯼﺮﺳ ﺪﯿﻧﺍﻮﺗ ﯽﻣ ،ﺪﯾﺭﺍﺪﻧ ﯽﯾﺎﻨﺷﺁ ﺖﻤﺴﻗ ﻦﯾﺍ ﺎﺑ ﺮﮔﺍ .ﻢﯿﻨﮐ ﺖﺒﺛ ﯽﺷﺭﺎﻔﺳ
/*
* Register CPT rc_faq
*
*/
function rc_faq_setup_post_types() {
$faq_labels = apply_filters( 'rc_faq_labels', array(
'name' => 'FAQs',
'singular_name' => 'FAQ',
'add_new' => __('Add New', 'rc_faq'),
'add_new_item' => __('Add New FAQ', 'rc_faq'),
'edit_item' => __('Edit FAQ', 'rc_faq'),
'new_item' => __('New FAQ', 'rc_faq'),
'all_items' => __('All FAQs', 'rc_faq'),
'view_item' => __('View FAQ', 'rc_faq'),
'search_items' => __('Search FAQs', 'rc_faq'),
'not_found' => __('No FAQs found', 'rc_faq'),
'not_found_in_trash' => __('No FAQs found in Trash', 'rc_faq'),
'parent_item_colon' => '',
'menu_name' => __('FAQs', 'rc_faq'),
'exclude_from_search' => true
) );
$faq_args = array(
'labels' => $faq_labels,
'public' => true,
'publicly_queryable'=> true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'capability_type' => 'post',
'has_archive' => false,
'hierarchical' => false,
'supports' => apply_filters('rc_faq_supports', array( 'title', 'editor' ) ),
);
register_post_type( 'rc_faq', apply_filters( 'rc_faq_post_type_args', $faq_args ) );
}
add_action('init', 'rc_faq_setup_post_types');
.ﺪﯿﻫﺩ ﺮﯿﯿﻐﺗ ﻪﻧﻭﺰﻓﺍ ﺩﻮﺧ ﺮﯿﯿﻐﺗ ﻥﻭﺪﺑ ﺍﺭ ﺎﻫ ﻥﺎﻣﻮﮔﺭﺁ ﻭ ﯽﻧﺎﺒﯿﺘﺸﭘ ﺎﺗ ﺪﻫﺩ ﯽﻣ ﻥﺎﮑﻣﺍ ﺎﻤﺷ
ﺪﯿﻨﮐ ﺩﺎﺠﯾﺍ ﻝﻭﺍﺪﺘﻣ ﺕﻻﺍﻮﺳ ﺶﯾﺎﻤﻧ ﯼﺍﺮﺑ ﻩﺎﺗﻮﮐ ﺪﮐ ﮏﯾ :3 ﻪﻠﺣﺮﻣ
.ﺪﯿﻫﺩ ﺶﯾﺎﻤﻧ ﺍﺭ ﺎﻫﺦﺳﺎﭘ ،ﺩﻮﺷﯽﻣ ﮏﯿﻠﮐ ﻥﺍﻮﻨﻋ ﯼﻭﺭ ﻪﮐ ﯽﻧﺎﻣﺯ ﺎﻬﻨﺗ ﻭ ﺪﯿﻨﮐ ﺖﺳﺮ
…ﻩﺮﯿﻏ ﻭ ﺱﺎﺳﺍ ﺮﺑ ﺵﺭﺎﻔﺳ ،ﺵﺭﺎﻔﺳ :ﺪﯿﻨﮐ ﻪﻓﺎﺿﺍ ﺍﺭ ﺩﻮﺧ ﯼﺎﻫﯽﮔﮋﯾﻭ ﺪﯿﻧﺍﻮﺗﯽﻣ ﻪﺘ
.ﺪﯿﺘﺴﻫ ﻩﺎﺗﻮﮐ ﺪﮐ ﯼﺍﺭﺍﺩ ﻪﺤﻔﺻ ﺭﺩ ﺎﻤﺷ ﻪﮐ ﺩﻮﺷ ﯽﻣ ﯼﺮﯿﮔﺭﺎﺑ ﯽﻧﺎﻣﺯ ﻂﻘﻓ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﻪﮐ
.ﻢﯿﻫﺩﯽﻣ ﺶﯾﺎﻤﻧ ﺍﺭ ﻥﺁ ،ﺩﻮﺷ ﮏﯿﻠﮐ ﻥﺁ ﻥﺍﻮﻨﻋ ﻪﮐ ﯽﻧﺎﻣﺯ ﺎﻬﻨﺗ ﻭ ﻢﯿﻨﮐﯽﻣ ﻥﺎﻬﻨﭘ
/*
* Add [rc_faq limit="-1"] shortcode
*
*/
function rc_faq_shortcode( $atts, $content = null ) {
extract(shortcode_atts(array(
"limit" => ''
), $atts ) );
// Define limit
if ( $limit ) {
$posts_per_page = $limit;
} else {
$posts_per_page = '-1';
}
ob_start();
// Create the Query
$post_type = 'rc_faq';
$orderby = 'menu_order';
$order = 'ASC';
$query = new WP_Query( array (
'post_type' => $post_type,
'posts_per_page' => $posts_per_page,
'orderby' => $orderby,
'order' => $order,
'no_found_rows' => 1
) );
//Get post type count
$post_count = $query->post_count;
$i = 1;
// Displays FAQ info
if ( $post_count > 0) :
// Loop
while ($query->have_posts()) : $query->the_post(); ?>
<h3 class="rc_faq_title"><a href="#" onclick="rc_faq_toggle('rc_faq_<?php echo get_the_ID(); ?>');"><?php the_title(); ?></a></h3>
<p id="rc_faq_<?php echo get_the_ID(); ?>" style="display: none;"><?php echo get_the_content(); ?></p>
<?php
$i++;
endwhile;
endif;
// Reset query to prevent conflicts
wp_reset_query(); ?>
<script type="text/javascript">
<!--
function rc_faq_toggle(id) {
var e = document.getElementById(id);
e.style.display = ((e.style.display!='none') ? 'none' : 'block');
}
//-->
</script>
<?php
return ob_get_clean();
}
add_shortcode( "rc_faq", "rc_faq_shortcode" ); ?>
!ﺲﺑ ﻭ
ﯽﯾﺎﻬﻧ ﻪﺠﯿﺘﻧ
:ﺖﺳﺍ ﺖﯾﺮﯾﺪﻣ ﺭﺩ ﯽﯾﺎﻬﻧ ﻪﺠﯿﺘﻧ ﺎﺠﻨﯾﺍ ﺭﺩ
:ﻥﺎﮔﺪﻨﻨﮐﺪﯾﺩﺯﺎﺑ ﻑﺮﻃ ﺯﺍ ﻭ
!ﻢﻨﮐ ﺖﻓﺎﯾﺭﺩ ﺕﺍﺮﻈﻧ ﺶﺨﺑ ﺭﺩ ﺍﺭ ﺎﻤﺷ ﺕﺍﺮﻈﻧ ﻢﻠﯾﺎﻣ ،ﺪﯿﺷﺎﺑ ﻩﺩﺮﺑ ﺕﺬﻟ ﺵﺯﻮﻣﺁ ﻦﯾﺍ ﺯﺍ ﻡﺭﺍﻭﺪ