• Resolved gregskuf

    (@gregskuf)


    Hi,
    I am trying to show custom taxonomy category name on a post grid but it seems like the category does not exist. But if I attach the same post to a build-in tax. category, the name of a category is shown where it supposed to be.

    Do you think it could be something like the custom taxonomy is not registered properly?

    Thanks in advance!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Could you provide the code you’re using for this display?

    If everything is showing properly in the backend, then chances are it’s registered right, but I’m curious about your querying for data and if there’s an issue there.

    If you could use the debug info tab, using these instructions, to send info my way, I can recreate with your settings.

    https://docs.pluginize.com/article/83-using-the-debug-info-tab-for-custom-post-type-ui

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Forgot to subscribe to email notifs.

    Thread Starter gregskuf

    (@gregskuf)

    will do, can you provide me your email address so I can send you the debug, please.

    thanks, G

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Oops, forgot that detail as well. michael @ webdevstudios. com will work.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    The code you’re using to try and display those details would be what’s left for me to proceed.

    Thanks

    Thread Starter gregskuf

    (@gregskuf)

    The basic visual composer grid builder has an option to call the category meta, but as this is not working I have tried the custom approach.
    As written in the plugin know-how’s there is a way to call the custom meta and create a shortcode.
    Here is the code I am using:

    
    add_filter( 'vc_grid_item_shortcodes', 'my_module_add_grid_shortcodes' );
    function my_module_add_grid_shortcodes( $shortcodes ) {
       $shortcodes['vc_say_hello'] = array(
         'name' => __( 'Say Hello', 'my-text-domain' ),
         'base' => 'vc_say_hello',
         'category' => __( 'Content', 'my-text-domain' ),
         'description' => __( 'Just outputs Hello World', 'my-text-domain' ),
         'post_type' => Vc_Grid_Item_Editor::postType(),
      );
       return $shortcodes;
    }
     
    
    add_shortcode( 'vc_say_hello', 'vc_say_hello_render' );
    function vc_say_hello_render() {
    	$terms = wp_get_post_terms( $post->ID, 'journal_categories' );
    	$term = array_shift( $terms );
    	return $term->slug;
    	
    }

    Nevertheless this is just a way around which is still not working (I hope the code above is correctly written).

    I think the main problem might be in priorities as I am reading on the other forums. The VC is getting included before taxonomies or something, but I am not technical enough to fix this.

    Thanks, G

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Ah, a detail that was missed previously. This is a Visual Composer detail, and not just creating your own grids via markup.

    I am not well versed in Visual Composer, both in general usage as well as customization.

    I know we have an issue with post types in their grid module, that we document workarounds for at http://docs.pluginize.com/article/24-visual-composer-grid-support-for-new-post-types

    Curious if you’re experiencing a similar issue here, where you need your taxonomy registered earlier on than it presently is.

    To match the docs code above for taxonomies, it’d be:

    remove_action( 'init', 'cptui_create_custom_taxonomies', 9 );
    add_action( 'init', 'cptui_create_custom_taxonomies', 1 );
    
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Custom taxonomy category name is not shown in grids’ is closed to new replies.