[resolved] Reorder video embeds outside of the_content (2 posts)

  1. fastasleep
    Posted 3 years ago #

    Not sure if this is possible, but in the content of my posts I have a Vimeo URL which is auto-embedded by WP, then a paragraph of description copy. Obviously in my template I can output the_title and the_content in whatever order I want. But is there a way to output the post like:

    - [vimeo embed]
    - the_title
    - the_content (minus vimeo — just the text)

    In that order? One possibility is to do it with CSS positioning, but the Vimeos are in a few different aspect ratios at 100% width, and it's a responsive design, so that's not as easy as navigating fixed sized elements.

    OR, is there a way that I could put the Vimeo link in a custom field and somehow get WP to process that in the same way it does the auto-embeds from links in the_content? That would be a great solution if there's a way to hook into that from functions.php.


  2. fastasleep
    Posted 3 years ago #

    Figured it out after reading more about the embed process, and found the hook:

    <?php echo wp_oembed_get( get_post_meta($post->ID, 'Video', true) ); ?>

    Where 'Video' is the name of my custom meta field, and just moved the Vimeo link from the body of the_content and pasted it there instead. Works great!

Topic Closed

This topic has been closed to new replies.

About this Topic