WordPress.org

Ready to get started?Download WordPress

Forums

Featured Video Plus
[resolved] How to replace featured image ONLY on post page (2 posts)

  1. mayan212
    Member
    Posted 1 month ago #

    Hello,

    Really love the plugin it does exactly what I was looking for!

    Unfortunately I've tried all the options and changing my css but my homepage layout keeps messing up.

    Example (latest post is currently using video overlay method) http://mayanpatel.com/blog2/

    Ideally I want:
    homepage - leave thumbnails untouched. use featured image
    post page - replace featured image with featured video

    How would I do this?

    https://wordpress.org/plugins/featured-video-plus/

  2. mayan212
    Member
    Posted 1 month ago #

    I managed to figure this out. This is what I did

    In settings > media. I chose the usage option (None of the above: Manually use PHP-functions or shortcodes) for featured video plus.

    Then I went into appearance > editor and found the php file that displays my single posts. For me it was single.php

    I found the place where it inserts my featured image and wrapped it in conditional tags.

    if ( has_post_video() ) {
        the_post_video();
    } elseif ( has_post_thumbnail() ) {
    	the_post_thumbnail();
     }
     ?>

    How it looks in my theme

    <?php
    if ( has_post_video() ) {
        the_post_video();
    } elseif ( has_post_thumbnail() ) {
       $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large');
       echo '<a href="' . $large_image_url[0] . '" title="' . the_title_attribute('echo=0') . '">';
       the_post_thumbnail('full');
       echo '</a>';
     }
     ?>

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.