WordPress.org

Ready to get started?Download WordPress

Forums

Post Category Index Generator
[resolved] Tags_and not working? (5 posts)

  1. da_sprite
    Member
    Posted 1 year ago #

    Hi,

    I seem to be unable to get the "Tags_and" parameter to work properly.

    Some background:
    I have a business directory where companies can be sorted by type (cafes, grocers, etc) and country (Australia, USA, etc). I let categories represent "type" while tags represent "country".

    When i try to show categories that contain only posts with the tag "australia", i run the shortcode:
    [pcig category=all-categories hide_empty=true links=subcategory_name tags_and=australia]

    This should work, but i seem to be getting posts with the tag "USA" appearing as well.

    Can anyone help?

    Really appreciate it, thanks.

    http://wordpress.org/extend/plugins/post-category-index-generator/

  2. Marco Constancio
    Member
    Plugin Author

    Posted 1 year ago #

    You have to use the parameter show. If you don't, the plugin will not display anything if that category doesn't have any subcategories,

    I changed the installation page to better indicate this.

  3. da_sprite
    Member
    Posted 1 year ago #

    Thanks Marco for your reply.

    I found that when i used the "show" parameter, the post (containing the desired tag) and the top category appear.

    To be absolutely clear, i'm trying to show only subcategories which contain posts tagged with my specific keyword. I'm not looking to display the posts.
    The opposite remains true: i'm trying to hide only subcategories which contain posts not tagged with my specific keyword.

    Appreciate your help greatly, Thanks!

  4. Marco Constancio
    Member
    Plugin Author

    Posted 1 year ago #

    The plugin uses the default wordpress function, so the tag function are only applied post and not categories. So, in order to do that you have to remove the categories by javascript.

    Add wp_enqueue_script( 'jquery' ); to the header.php of you theme and add, to the post after the shortcode, the following code:

    <script type="text/javascript">
    jQuery('.pcig-category').each(function(index, value) {
      if(jQuery(this).parent().next().is('li')){ jQuery(this).parent().remove(); } });
    </script>

    and it should do what you want.

  5. da_sprite
    Member
    Posted 1 year ago #

    Works like a charm. Thanks so much!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags