How to add featured image support to Magazine theme.

I'd like to add the feature image functionality into this theme somehow. I know that the theme itself doesn't utilize this functionality and instead pulls the first image in a post. I want it to make other widgets and calls function.

Is this a feature request or can I make a simple change to the functions.php?

  • Timothy Bowers
    • Chief Pigeon

    Hey there.

    If its not available then you can add the following to the functions.php:

    add_theme_support( 'post-thumbnails' );

    This then enabled featured images within the admin area.

    You would then need to pull the image, for this you would edit the loop and add this:

    if ( has_post_thumbnail() ) {
    	the_post_thumbnail();
    }

    Which will show the featured image.

    If you want a custom size then you could do this:

    if ( has_post_thumbnail() ) {
    	the_post_thumbnail(array(350,350));
    }

    the 350, 350 are the pixel size.

    So the loop, open up single.php and around line 19 you will see this:

    <?php the_content( __( '<p class="serif">Read the rest of this entry »</p>', 'bp_magazine' ) ); ?>

    You could add the thumb code area there like:

    <?php if ( has_post_thumbnail() ) {
    	the_post_thumbnail(array(350,350));
    } 
    
    the_content( __( '<p class="serif">Read the rest of this entry »</p>', 'bp_magazine' ) ); ?>

    I've not tested this, but it should work. You will probably want to do some CSS for styling as well.

    Take care.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.