Support » Themes and Templates » Latest blog post in footer
Latest blog post in footer
-
Hello everyone,
I need help in coding my site. I need to be able to add the latest post / news title and exceprt in my footer but I am having a little trouble doing it.
Are there any guides out there?
Thanks,
Ben.
No Bumping
Do not bump posts. Bumping a post to “the top” does not help your topic get noticed. The volunteers who try to answer questions look for those without replies first. If you bump a post, then it disappears from the “No Replies” view. DO NOT BUMP.Moderators will delete bumps they find. This is in order to help you get back into the No Replies listing, where you are more likely to get an answer.
-
You should use WP_Query
I still havent figured this out please can someone help me please?
add the latest post / news title and exceprt in my footer
edit footer.php, find a suitable location, and add for example:
<?php $latest = new WP_Query( array( 'posts_per_page' => 1 )); if( $latest->have_posts() ) : ?> <div class="latest-post"> <?php while( $latest->have_posts() ) : $latest->the_post(); ?> <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> <?php the_excerpt(); ?> <?php endwhile; ?> </div> <?php endif; wp_reset_postdata(); ?>
Hi alchymyth,
Thank you very much for this. It is perfect and it works well in my theme. I think I need to start to code more in php wordpress to get as good as you.
Thanks again 🙂
How do you get the thumbnail show?
please start your own topic;
if you need to refer to this topic here, add a link to your topic.
I wouldn’t mind knowing this to be honest! I know alchymyth kindly helped me last time but I would like to know this. I have used a plugin for this but it doesn’t work and I have tried to play with the PHP code but to no avil. Any suggeststions?
Thanks 🙂
As he just posted, start your own thread.
Have a look at the OP!! That would be me 😉
it is really not helpful to post from different accounts with different usernames and to expect anybody to do the detective work to figure this out.
the Codex has information on ‘featured images’ also known as post_thumbnails: http://codex.wordpress.org/Post_Thumbnails
what exactly have you tried in the code?
Hey,
Wow I didn’t even notice that I had two accounts! I lost one a while back and couldn’t remember the user / pass! Anyway, I have been to the link that you provided and have written my own code, I will have another blast at it but though that you might have a easy solution. Thanks again for your help.
- The topic ‘Latest blog post in footer’ is closed to new replies.