Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to print featured image in wordpress

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 299
    Comment on it

    Hello Reader's! If you learning the wordpress and want to show the contents of a page from admin panel. Then you can use the code below:-

    First you need to publish the page with it's title, content and a featured image. Now open the page and write the code below where you want them.

    <?php 
    if ( have_posts() ) {
            the_post(); 
        $thumb_img = wp_get_attachment_image_src(get_post_thumbnail_id(), 'medium' );      
    ?>
    

    // this will be your title

    <img src="<?php echo $thumb_img[0];?>"> // this will be your image
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: