how to use shortcode with php?

Home Forums Ticket Products Event Tickets Plus how to use shortcode with php?

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1190829
    Devon Morris
    Participant

    how to use this below shortcode with php?
    [tribe_events view=”list” tribe-bar=”false” category=”DFW Metroplex]

    #1190841
    Gergana
    Participant

    Hi Devon,

    It can be done by using the wordpress function do_shortcode. I am providing you an example of how I’ve implemented a “Smart Countdown FX”s shortcode into the single_event.php.

    <?php
    $start_event_date_event = tribe_get_start_date( $event_id, true, 'Y-m-d h:i:s' );
    if ( !empty($start_event_date_event = tribe_get_start_date( $event_id, true, 'Y-m-d h:i:s' ) ) ) {
    
     echo do_shortcode( '[smartcountdown deadline="' .$start_event_date_event. '" fx_preset="Sliding_text_fade.xml" digits_style="font-family:Lucida Sans Unicode, Lucida Grande, sans-serif;font-weight:bold;" labels_size="19" title_before_down="Време до Началото" widget_style="text-align:center;" mode="countdown" units="days,hours,minutes,seconds"]' );
    }
    ?>

    It is working with me.

    • This reply was modified 9 years, 5 months ago by Gergana. Reason: inputing it into code
    #1190860
    Devon Morris
    Participant

    Hi Gergana,

    actually i want to use this code in my custom homepage and plz send me this code only.

    #1190866
    Devon Morris
    Participant

    can i use single-event.php all code to my custom homepage? i want to create page like attached file below.

    #1191613
    Cliff
    Member

    Hi Devon. Thanks for your question. A few separate things to note here:

    1)

    Gergana offered a great snippet just as an example how to execute your shortcode within PHP. Her answer is correct that you would use do_shortcode(), just like she demonstrated. Thanks, Gergana!

    However, it sounds like your initial question wasn’t exactly what you were after, which is okay. 🙂

    2)

    Our tribe_events shortcode does not currently support the “category” argument/parameter/option, which is why it’s not working for you as expected. This functionality is on our to-do list for the future.

    I’ve marked this thread to receive a reply once this functionality is released. I cannot guarantee when it will be, as it’s in development.

    I appreciate your understanding and patience on this issue.

    3)

    I appreciate your question and the desire to customize it for your use. However, we cannot provide such in-depth customization help, per our Scope of Support / Terms.

    It sounds like you’re looking to make a customization of the archive/loop of events, for which you should use template overrides, documented in our Themer’s Guide, instead of a shortcode.

    Once yoursite/events/list looks how you want it to look, then implement the shortcode on your homepage if that’s where you want to display your events.

    If you need some coding help, you may want to ask your developer or reference our documentation and list of known customizers.

     

    Thank you.

    #1193608
    George
    Participant

    Hello!

    I wanted to inform you that we’ve just published a series of updates to our products that fixes a number of issues.

    Full category support for the [tribe_events] shortcode is included in these updates! 😀

    Learn more about this release—version 4.3.3—in the official release notes here → https://theeventscalendar.com/maintenance-release-events-calendar-4-3-3-event-tickets-4-3-3-premium-plugins/

    Thanks for your patience while we fixed this!
    George

    #1203206
    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 7 posts - 1 through 7 (of 7 total)
  • The topic ‘how to use shortcode with php?’ is closed to new replies.