• I love the way this plugin works. it does just what I’ve been looking for.

    Unfortunately it’s not very practical for me to create a separate page for each category because the site owners constantly add content and categories and the navigation needs to be generated without my input.

    So, ideally I would like to edit the archive.php file which generates the category archive page to include the your shortcode. Is there any way for the category ID to be picked up by your plugin?

    Thanks for creating this plugin.

    https://www.ads-software.com/plugins/post-category-index-generator/

Viewing 1 replies (of 1 total)
  • Thread Starter janeew

    (@janeew)

    Here’s the solution I’m using in case anyone else is trying to do the same thing.
    In the archive.php file I added…

    <!--To display the index generated by the POST CATEGORY INDEX GENERATOR Plugin-->
    <?php
    if (is_category( )) {
    $cat = get_query_var('cat');
    $yourcat = get_category ($cat);//this is the code to get the category name
    }
    
    echo do_shortcode('[pcig category="'.$yourcat->slug.'" display=tree show=post_title links=post_title hide_empty=true]');//this is the shortcode call
    
    ?>
    
    <!--end of index listing -->

    There may be more elegant ways to do this but it seems to work. Now the category archive view displays the posts within their subcategories.

Viewing 1 replies (of 1 total)
  • The topic ‘Category ID as a variable’ is closed to new replies.