Support » Plugin: WP Awesome FAQ Plugin » Display complete list of categories

  • Resolved dotwebs

    (@dotwebs)


    Hi,

    I really like this plugin, thank you for creating it.

    I want to show all my FAQs on one page but in their category groups. So at the moment I’m displaying them on a page like this – where each category name has to be typed in over the appropriate category:

    Category One Name
    
    [faq cat_id="1"]
    
    Category Two Name
    
    [faq cat_id="2"]

    I will have quite a few categories so I’m wondering how I can display all the categories like this automatically. I can only see the shortcode for displaying all FAQs uncategorised.

    Thanks in advance.

    https://wordpress.org/plugins/wp-awesome-faq/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Liton Arefin

    (@litonice13)

    Hello dotwebs,
    You’ll get this Feature on Premium Version.
    https://jeweltheme.com/product/wordpress-faq-plugin/

    Thanks

    Hi Liton,

    Okay, that’s good to know. Thanks for your quick reply.

    @dotwebs: i have your same need and i create a template page called “allfaq” with this code inside (based on twentysixteen theme)

    <?php
    /*
    Template Name: allfaq
    pagina per mostrare i risultati di ricerca
    
    */
    
    get_header(); ?>
    	<div id="primary" class="content-area">
    
    		<main id="main" class="site-main" role="main">
    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    <div class="entry-content">
    	<?php
    
    //retrieve all cat name
    $taxonomy = 'faq_cat';
    $term_args=array(
      'hide_empty' => false,
      'orderby' => 'name',
      'order' => 'ASC'
    );
    $tax_terms = get_terms( $taxonomy, $term_args );
    
    foreach ( $tax_terms as $tax_term ) {
     echo "<a href=".$tax_term->slug.">".$tax_term->name."</a> -";
    
        $count = 0;
        $accordion = 'accordion-' . time() . rand();
    $args=array(
    'post_type' => 'faq',
    'taxonomy' => 'faq_cat',
    'term' => $tax_term->name,
    'order'  => 'DESC',
    'orderby'  => 'date',
    'showposts' => '-1'
    );
    $the_query = new WP_Query($args);
    while ( $the_query->have_posts() ) :
        $the_query->the_post();
    
    ?>
    	<div class="accordion" id="<?php echo $accordion .  $count;?>">
    
                    <h3><?php the_title();?></h3>
                    <div>
    
                        <?php the_content();?>
                    </div>    
    
                    <?php  //end while
                 ?>
            </div>
    
     <?php endwhile; ?>
    
      <?php
    }
    ?>   
    
    </div>
     </article><!-- #post-## -->
    		</main><!-- .site-main -->
    	</div><!-- .content-area -->
    <?php
    // Ripristina Query & Post Data originali
    wp_reset_query();
    wp_reset_postdata();
     ?>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    now i have
    in one page all cat with his faq
    ie.:
    cat1
    – faq1
    – faq2
    – faq5
    cat2
    – faq4
    – faq3
    – faq6
    cat3
    – faq7
    – faq11
    – faq9

    etc….

    try it and let me know…

    sorry here the right code

    <?php
    /*
    Template Name: allfaq
    
    */
    
    get_header(); ?>
    	<div id="primary" class="content-area">
    		<main id="main" class="site-main" role="main">
    <div class="entry-content">
    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    	<?php
    //part of template-offer.php
    $taxonomy = 'faq_cat';
    $term_args=array(
      'hide_empty' => false,
      'orderby' => 'name',
      'order' => 'ASC'
    );
    $tax_terms = get_terms( $taxonomy, $term_args );
    
    foreach ( $tax_terms as $tax_term ) {
     echo "<a href=".$tax_term->slug.">".$tax_term->name."</a> -";
    
        $count = 0;
        $accordion = 'accordion-' . time() . rand();
    $args=array(
    'post_type' => 'faq',
    'taxonomy' => 'faq_cat',
    'term' => $tax_term->name,
    'order'  => 'DESC',
    'orderby'  => 'date',
    'showposts' => '-1'
    );
    $the_query = new WP_Query($args); ?>
    
    <?php
    while ( $the_query->have_posts() ) :
        $the_query->the_post();
    
    ?>
    	<div class="accordion" id="<?php echo $accordion .  $count;?>">
                    <h3><?php the_title();?></h3>
                    <div>
                        <?php the_content();?>
                    </div>
        </div>
     <?php endwhile; ?>
    <?php } ?>
    </article><!-- #post-## -->
    </div><!-- .entry-area -->
    </main><!-- .site-main -->
    </div><!-- .content-area -->
    <?php
    // Ripristina Query & Post Data originali
    wp_reset_query();
    wp_reset_postdata();
     ?>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Display complete list of categories’ is closed to new replies.