WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Page Template and Page Content (4 posts)

  1. mikeGolf
    Member
    Posted 2 years ago #

    I'm trying to add video code to the page template and fill in the variables in the page content. I cant seem to get it to work.

    I want to display in this order

    page title
    video
    page content
    back button - share buttons

    I need a way to set the data for the video and back button link in the content. Things like file name, url and alt text.

    Some test code that doesn't work

    In page template PHP file

    <?php echo '<img class="button" src="Video-Background.jpg" alt="'.$videoAlt.'">' ?>

    And in the page content

    <?php $videoAlt = "text alt text"; ?>

  2. Gary Darling
    Member
    Posted 2 years ago #

    You should try 'shortcodes', perhaps you could create one that puts all the variable holders in the template, then you insert the actual variables with the shortcode in the editor:
    [my_shortcode video=13 alt="foo" width=400]Video Title[/my_shortcode]

    See:
    http://codex.wordpress.org/Shortcode_API

  3. mikeGolf
    Member
    Posted 2 years ago #

    Thanks garydarling I will look into shortcodes

  4. mikeGolf
    Member
    Posted 2 years ago #

    shortcode worked out nicely thanks again.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.