• Resolved juzammar

    (@juzammar)


    I would like to be able to insert tags in terms of the glossary, just as we can add tags to articles and pages in wordpress. Would you be able to do this?Thank you

    The page I need help with: [log in to see the link]

Viewing 11 replies - 1 through 11 (of 11 total)
  • Tags are just for posts but Glossary terms are another post type and we offer a glossary taxonomy for that.
    If you want to add support for tags also on glossary terms you need this php snippet:

    add_action( ‘init’, ‘register_taxonomy_for_object_type’ );
    function register_taxonomy_for_object_type() {
    register_taxonomy_for_object_type( ‘post_tag’, ‘glossary’ );
    };

    Thread Starter juzammar

    (@juzammar)

    Great! And where do I put this php snippet?
    Thanks a lot for the help.

    In the functions.php file of your theme.

    Thread Starter juzammar

    (@juzammar)

    Snippet has not been activated due to an error.

    Error message:

    Cannot redeclare register_taxonomy_for_object_type() (previously declared in /home1/sonho152/special-offer-hub.com/wp-includes/taxonomy.php:722)

    What can be wrong?

    I added using WP code snippets plugin

    Thank you.

    Sorry my fault, this one should fix the issue:

    add_action( ‘init’, ‘glossary_register_taxonomy_for_object_type’ );
    function glossary_register_taxonomy_for_object_type() {
    register_taxonomy_for_object_type( ‘post_tag’, ‘glossary’ );
    };

    Thread Starter juzammar

    (@juzammar)

    I’m embarrassed, but it still didn’t work out…
    Now the following error appears:

    We encountered an error activating your snippet, please check the syntax and try again. Error message:?Undefined constant ‘init’

    Im sorry!

    I asked ChatGPT. This should work (works for me at least):

    add_action('init', 'glossary_register_taxonomy_for_object_type'); function glossary_register_taxonomy_for_object_type() { register_taxonomy_for_object_type('post_tag', 'glossary'); }

    Yes, sorry I copy/pasted a snippet and changed some things but I didn’t noticed that it was using the OSX apix.

    This one fix the issues:

    add_action( 'init', 'glossary_register_taxonomy_for_object_type' );
    function glossary_register_taxonomy_for_object_type() {
    register_taxonomy_for_object_type( 'post_tag', 'glossary' );
    }

    Is it possible to use the tags in your shortcodes?

    Like this if I want to show only entries of the tag “SEO”:
    [glossary-terms order=”desc” num=”3″ tag=”seo”]

    • This reply was modified 1 year, 7 months ago by Joehann.

    No, our code support only the native glossary-cat taxonomy and not others.
    If you want to do that, you need to copy and change the php code to create a new shortcode.

    Check our documentation https://docs.codeat.co/glossary/shortcodes/#list-of-terms

    Closing after 3 weeks

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘tag in terms’ is closed to new replies.