• Hi, I am trying to create a page template for my site that displays a different youtube video at the top of every page. I need the template to have parameters that could be filled through its own little widget on the side of my editor or just another page attribute?

    My template looks something like this:

    <?php
    /*
    Template Name: Video 
    Template Post Type: post
    */
    
    get_header(); ?>
    
    <iframe src="https://www.youtube.com/embed/[YOUTUBE_ID]" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="" width="100%" height="450" frameborder="0"></iframe>
    
    <?php
    get_sidebar();
    get_footer();

    Instead of hard coding a single youtube vid, the “[YOUTUBE_ID]” part could be replaced with whatever video id I put in that field. Is this possible?

    • This topic was modified 4 years, 7 months ago by userperson.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Page Tempates with custom fields’ is closed to new replies.