Support » Fixing WordPress » Featured image issues – custom coding

  • RVDA55

    (@rvda55)


    Hi all!

    I’ve been trying to get a featured image in my theme and it is showing up. Unfortunately it does not ‘replace’ any inserted images.

    For example I have in a post (from text tab);

    <img class="size-full wp-image-25 alignleft" alt="stackedclouds-1" src="http://localhost/wordpress/wp-content/uploads/2013/07/stackedclouds-1.jpg" width="600" height="400" />Welcome to WordPress. This is your first post. Edit or delete it, then start blogging! <!--more-->

    It’ll then show up two images instead of just one (the featured image). Normally you would see a featured image appear instead of the inserted image. I think at least.

    Here’s the theme I’m working on: Test Site

    Also the text ‘Welcome to WordPress. This is your first post. Edit or delete it, then start blogging! Read more..’ on the index of the website doesn’t appear next (to the right) of the featured image once no images have been inserted into the post itself.

    I managed to come this far but now I’m stuck after trying a bunch of tutorials and codex pages.

    Can someone tell me what code I need to insert and where to fix these two issues? I’d like to use ‘manual’ coding instead of plugins.

    Thanks for any replies.

    Regards, Rudolf

Viewing 4 replies - 1 through 4 (of 4 total)
  • shadez

    (@shadez)

    index.php is used from your theme file to display homepage if you dont have front-page.php present.. so edit likewise..

    1. the_post_thumbnail(); is used to display featured image.
    2. if you use the_content your complete post contents are displayed, including images
    3. if you use the_excerpt, the images from your posts are skipped
    4. you can change excerpt length by adding a filter in functions.php

    so, either remove thumbnail code, or use the_excerpt..

    RVDA55

    (@rvda55)

    Hi shadez, thanks for your reply.

    I now replaced ‘the_content’ with ‘the_excerpt’ and the ‘second’ image finally disappeared.

    I also added some extra filter like you suggested and some code to show the ‘read more’ link which is not showing. This is my first WordPress theme so excuse my newbness.

    What do I do to have the read more link show? The read more tag is already in the post itself and also in the functions.php.

    Also the text of the post is still not showing to the right of the featured image instead of below it. How do I get it to show right next to it?

    shadez

    (@shadez)

    RVDA55

    (@rvda55)

    Hey!

    Yeah I floated the thumbnail to the left and added some margin.

    Also, it appears the read more link appears only after a certain amount of words. Is there any way I can make it always appear? I tried using the read more tag from the wordpress text editor but it doesn’t show.

    Ideally, I would be able to only have the read more tag show by inserting it manually from the wordpress text editor.

    Any thoughts on that?

    Regards, Rudolf

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Featured image issues – custom coding’ is closed to new replies.