show event date as custom shortcode in visual composer grid builder

Home Forums Calendar Products Events Calendar PRO show event date as custom shortcode in visual composer grid builder

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1244838
    Steve
    Participant

    am probably doing this all wrong but not really a coder: how do i create a custom shortcode for gridbuilder so that i can control the date output format – here is my attempt, that doesn’t work

    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() {
       echo tribe_get_start_date($post, false, $format = 'g:i a' );
    }
    #1246385
    Nico
    Member

    Hi there Steve,

    Thanks for reaching out and sorry for the delay in my reply! I assigned this issue to myself but lost track of it until now…

    I’m not really familiarized with how gridbuilder shortcodes are actually coded, you’ll have to reach out to their developers to get help.

    From what I see I guess you are not getting the desired result because $post might not be set to the current event you are trying to output the date for. If the first parameter is null the function will try to get the current post object. Also, when you pass the parameters to the function there’s no need to declare the variable name:


    echo tribe_get_start_date(null, false, 'g:i a' );

    Hope that helps,
    Best,
    Nico

    #1257361
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘show event date as custom shortcode in visual composer grid builder’ is closed to new replies.