WordPress.org

Ready to get started?Download WordPress

Forums

Add shortcode to page template file (3 posts)

  1. fvo
    Member
    Posted 3 years ago #

    Hello,

    I want to add Video JS to mij wordpress site. But i can't get it to work with fallback to flowplayer.
    There are some plugin's that will do the trick, but then i have to use a shortcode in my text.

    Is there a solution where i can put the shortcode in a custom field and put this in a <div> in my template file?

    Thank you

  2. fvo
    Member
    Posted 3 years ago #

    Found the solution i think..

    <?php echo apply_filters('the_content', get_post_meta($post->ID, 'your_custom_field_here', true)); ?>

    This snippet will enable you to add shortcode to a wordpress custom field. Normally wordpress does not run shortcodes that you put into a custom field. Just put this code into whatever page you are displaying the results of the shortcode, and change the 'your_custom_field_here' to the name of your custom field.

  3. Justin Sternberg
    Member
    Posted 3 years ago #

    very helpful. thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic