dp friend help me

Discussion in 'HTML & Website Design' started by anindya420, Oct 4, 2013.

  1. #1
    i am working on word press template there i need active featured image on custom template .how can i do it .
     
    Solved! View solution.
    anindya420, Oct 4, 2013 IP
  2. #2
    To add support for featured images in WordPress you need to ad to your functions.php next code: (or if doesn't exist a functions.php file inside your theme root, create it).
    <?php
    if(function_exists('add_theme_support')) {
         add_theme_support('post-thumbnails');
    }
    /* Add a new size and crop image to 250x200 px */
    add_image_size( 'image-name', 250, 200, true );
    ?>
    PHP:
    To call your new image format somewhere in template files use:
    <?php
    if ( has_post_thumbnail() ) {
         the_post_thumbnail('image-name');
    }
    ?>
    PHP:
    More info on WordPress codex.
     
    Last edited: Oct 4, 2013
    Hefaistos, Oct 4, 2013 IP
  3. anindya420

    anindya420 Member

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    31
    #3
    thanks
     
    anindya420, Oct 4, 2013 IP