How do I call a shortcode from the template?

This topic contains 2 replies, has 3 voices, and was last updated by  Alex Rollin 4 years, 1 month ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #534093

    Derek Brown
    Expired Member
    Post count: 28

    I have a custom field in my geodirectory called video. This custom field asks for the unique code from a youtube video url.
    I understand that I can call this information to a page by using the dynamics widget and the geodirectory shortcode %%video%%
    That’s great, however,
    I need to check this field before rendering it to the page.
    I wanted to write code with the template that will check to make sure the video field has a value, as in
    if (isset(%%video%%)) {
    do something
    }
    Problem is %%video%% does not work in the php code of a template (didn’t expect it to)
    So my question is, how do I get the value of a field from within the template.
    Thanks

    #534102

    Kor
    Moderator
    Post count: 16516

    Hi Derek Brown,

    Thanks for your post. You can use the post meta shortcode https://wpgeodirectory.com/docs-v2/design/gd-post-meta/ . Is this what you’re looking for?

    #534170

    Alex Rollin
    Moderator
    Post count: 27815

    GD Post Meta will only show the field if it has a value.

Viewing 3 posts - 1 through 3 (of 3 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket