Support » Plugins » Plugin Easy Post Types-How to get Categories and Tags out of the WP Loop

  • Hello everybody

    I´m from Brazil, and I have a doubt related to Plugin Easy Post Types.

    A friend is using custom post type coding manually, not using plugins.

    So, she was trying to list categories out of the wordpress loop as we usualy list categories like <?php wp_list_categories( $args ); ?>

    But, she just can do it, inside the wordpress loop.

    Researching about that, she discovered something very important:

    She creted a php file like app_functions.php and inside this file she coded all php code that is necessary to create a particular custom post type.

    And on functions.php she coded:

    if( is_admin()) require(“app_functions.php”);

    She used this IF to avoid extra and unnecessary processing.

    So, she just can see categories and tags related to her custom post types on admin interface, and when she try to list a custom categories (like this <?php wp_list_categories( $args ); ?> ) from that custom post on template theme, that does not work, because is not is_admin

    So, I think your plugin has the same issue, because I cant list categories out of the loop, because this should be a global variable and not local.

    I think that this forum post can help you to understand the situation

    On my localhost test, I´m using the codes below to retrieve the custom tags and custom categories, but this work just inside the loop:

    <?php the_meta(); //retrieve custom fields?>

    <p><?php echo get_the_term_list($post->ID, ‘my_custom_tags’, ‘My Custom Tags: ‘, ‘, ‘, ” ); //retrieve the custom tags?></p>

    <p><?php the_terms($post->ID, ‘my_custom_categories’, ‘My custom Categories: ‘, ‘ | ‘); //retrieve the Categories?></p>

    So, I don´t know what modifications (if is necessary) to do on your plugin to list categories and tags out of the wordpress loop.

    Thanks in advance.

    Flávio Araújo
    São José dos Campos, SP, Brazil

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello everubody

    On WP Discussion List here in Brazil I just found the solution:

    <?php wp_list_categories('taxonomy=YOUR_TAXONOMY_NAME&hide_empty=0&title_li=') ?>

    This works inside and outside wordpress loop perfectly.

    So, I´m closing this ticket.



    thanks for this solution

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Plugin Easy Post Types-How to get Categories and Tags out of the WP Loop’ is closed to new replies.