WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Can not put image in the top of article. (18 posts)

  1. Md. Ariful Islam
    Member
    Posted 1 year ago #

    I want to put feature image into top of article on my single post page.

    website page link:http://www.lifestylenews.co/body/duffys-brew-beer-shampoo/

    Please help me anybody.

  2. hawaiiwp
    Member
    Posted 1 year ago #

    If this is not an option in your theme, it's a rather advanced thing to "code" into the single.php file.

    I found this code in another post, but I'm not sure if it will work with your theme.

    Put this in your functions.php:

    add_theme_support( 'post-thumbnails' );
    set_post_thumbnail_size( 80, 55, true ); // W x H, hard crop

    Put this in your single.php loop:

    <?php
    if ( has_post_thumbnail() ) {
    	// the current post has a thumbnail
    	the_post_thumbnail();
    } else {
    	// the current post lacks a thumbnail
    }
    ?>
  3. hawaiiwp
    Member
    Posted 1 year ago #

    Oh, Sorry, put the second code in your single.php file, not the index.php.

  4. Md. Ariful Islam
    Member
    Posted 1 year ago #

    It is working , But, I want to put image into post description.

  5. Md. Ariful Islam
    Member
    Posted 1 year ago #

    Where I found the loop for single.php.

    Single.php has code like bellow:
    <?php get_header(); ?>

    <div id="content">

    <?php

    get_template_part('loop', 'single'); ?>

    </div><!-- #content -->

    <?php get_sidebar(); ?>

    <?php get_footer(); ?>

  6. Md. Ariful Islam
    Member
    Posted 1 year ago #

    After follow your instruction, The thumbnail shows top of the post title.

    But I need not show thumbnail into description. by putting exact code.

  7. Md. Ariful Islam
    Member
    Posted 1 year ago #

    May be this link is support to understand my problem: http://www.lifestylenews.de/?p=4475

  8. Md. Ariful Islam
    Member
    Posted 1 year ago #

    @hiarlen Please help me.

  9. hawaiiwp
    Member
    Posted 1 year ago #

    I'm not exactly sure where you want the image.

    What theme are you using?

  10. hawaiiwp
    Member
    Posted 1 year ago #

    can you post the contents of your loop.php file.
    :)

  11. Md. Ariful Islam
    Member
    Posted 1 year ago #

    I am using Unspoken theme.

    My problem page link: http://www.lifestylenews.co/vices/hot-blondies-bakery-treats/

    Wanted to like this: : http://www.lifestylenews.de/?p=4475

  12. Md. Ariful Islam
    Member
    Posted 1 year ago #

    The two sites are used same theme

  13. hawaiiwp
    Member
    Posted 1 year ago #

    single.php is actually using another page called loop.php.

    Can you post the contents of loop.php.
    The code I originally asked you to put into single.php will need to go into another place so the image appears where you want it to.

  14. Md. Ariful Islam
    Member
    Posted 1 year ago #

    theme folder contain three loop file called loop.php,loop-single.php and loop-page.php . which file I can use.to input your code.

  15. Md. Ariful Islam
    Member
    Posted 1 year ago #

    problem solved. Thank you very match. I am really grateful to you.

  16. hawaiiwp
    Member
    Posted 1 year ago #

    Remove the code from single.php

    Add the code to loop-single.php

    You're looking to put it below the meta information and above the post content.

    You may have to also add some CSS:

    .attachment-post-thumbnail
    {
    display:block;
    float:left;
    }
  17. hawaiiwp
    Member
    Posted 1 year ago #

    Great! Sorry for all the trouble. Different themes place code in different places. Glad it's working for you. :)

  18. Md. Ariful Islam
    Member
    Posted 1 year ago #

    I am really proud of your support. Thanks..........

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.