• Resolved eliejolliet

    (@eliejolliet)


    Hello,

    I would like to use your plugin which seems ery easy to use. Is it possible to use custom taxonomies like “usual categories”, e.g. create archive pages for it and mention the custom taxonomies on every post? I don’t get it and whitout that possibility it doesn’t make sense for me.

    Thank you and best wishes!
    Elie

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Andrea De Giovine

    (@andreadegiovine)

    Hi @eliejolliet thanks for using the plugin!

    To show the Taxonomies in the templates you have to create a shortcode that does this.

    Here is an example of a shortcode that you can insert in the theme’s functions.php and then use it in the template (inserting it as a shortcode):

    function print_tax_func() {
    $current_post_id = get_the_ID();
    $all_tax = get_taxonomies(array( 'name' => 'TAXONOMY_NAME' ));
    $output = implode(', ', $all_tax);
    return $output;
    }
    add_shortcode( 'print_tax', 'print_tax_func' );

    Enter this code at the end of functions.php, replace TAXONOMY_NAME with the name of the taxonomy and use the shortcode [print_tax] when creating the template.

    If you want to support the growth of the plugin and the release of new features in the next updates, leave your review ??

    Hello, like the original poster, I have a custom post type, using a custom template, and would like to display the custom taxonomies attributed to each custom post, much like you can with ‘categories’ and ‘tags’.

    I’ve tried the adding the above functions.php code, but the resulting shortcodes aren’t returning anything when the custom post is rendered. No errors, just an absence of any HTML whatsoever. Other shortcodes in the template seem to be working fine.

    If I can get this to work, your plugin does everything I need it to!

    For info the precise code I am using is:

    function print_disciplines_func() {
    $current_post_id = get_the_ID();
    $all_tax = get_taxonomies(array( 'name' => 'disciplines' ));
    $output = implode(', ', $all_tax);
    return $output;
    }
    add_shortcode( 'discipline_list', 'print_disciplines_func' );

    `

    where ‘disciplines’ is the slug of my custom taxonomy.

    Any ideas?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Taxonomies in front end’ is closed to new replies.