Custom Feature Image Function

Community Forums Forums General Discussion Custom Feature Image Function

This topic is: not resolved

Tagged: , ,

This topic contains 4 replies, has 2 voices, and was last updated by  tristanjud 1 year, 1 month ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #58680

    tristanjud
    Participant
    Post count: 2

    Hi,

    I’ve just switched back to Genesis after a bit of hiatus using a theme from Obox. I’ve purchased the Metro theme as is this the closest to what I was looking for.

    The Obox theme I was using had a custom input form element in the “add new post” page called Video Link. I used WordPress’s inbuilt oEmbed feature to display a video where the featured image was if there was no feature image present.

    This seems fairly easy to code up however I’m struggling to find a hook or filter to customize the feature image function of Genesis. Obviously the Metro theme relies heavily on widgets which I’ve setup using the instructions provided.

    So can someone tell me how to go about customising the functionality of the feature image output?

    Thanks,
    Tristan

    http://raw.tristanjud.com
    #58697

    AC
    Blocked
    Post count: 7712

    I think (I could be wrong) that you are looking for this. I use it on all of my sites. It renders the thumbnail image of the Youtube video if you haven’t used the Featured Image. The thumbnail will not appear until you actually publish the post though.

    http://wordpress.org/plugins/featured-video/

    #58702

    tristanjud
    Participant
    Post count: 2

    Anitac, pretty cool but not quite what i’m after.

    Since I already have 100′s of posts that have used the custom form input in my previous theme, i’m looking for away to customise the feature image output function so that i can check to see if this other field is valid or not.

    #58703

    AC
    Blocked
    Post count: 7712

    Okay, I didn’t anticipate 100′s! I know Brad Dalton of WPSites.net who posts here on the forum writes a lot of custom code/tutorials. Check out his site to see if he has anything that will work or reach out to him. He might be able to just write you something.

    #58723

    tristanjud
    Participant
    Post count: 2

    For those interested this is where i’ve got to. It displays the “featured image” or the “oEmbed” video on the single post page.

    I haven’t been able to get it to work with the front page widgets such as “genesis feature post” widget etc… just yet.

    add_action( 'genesis_before_post_content', 'feature_image_video'  ); 
    function feature_image_video() {
    	if (get_post_meta(get_the_ID(), 'video_link', true) != '') {
    		$feature_video_link = get_post_meta( get_the_ID(), 'video_link', true );
    		$embed_code = wp_oembed_get( $feature_video_link, array('width'=>676) ); 
    		echo $embed_code;
    	} else {
    		the_post_thumbnail( 'custom_feature_size' );
    	}
    }
Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.