• benjaminWP

    (@benjaminwordpress)


    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.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter benjaminWP

    (@benjaminwordpress)

    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(); ?>

    https://codex.www.ads-software.com/Class_Reference/WP_Query

    Thread Starter benjaminWP

    (@benjaminwordpress)

    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 ??

    jaxace

    (@jaxace)

    How do you get the thumbnail show?

    Michael

    (@alchymyth)

    @jaxace

    please start your own topic;

    if you need to refer to this topic here, add a link to your topic.

    BEdesign

    (@bedesign)

    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 ??

    WPyogi

    (@wpyogi)

    As he just posted, start your own thread.

    BEdesign

    (@bedesign)

    @wpyogi

    Have a look at the OP!! That would be me ??

    Michael

    (@alchymyth)

    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: https://codex.www.ads-software.com/Post_Thumbnails

    what exactly have you tried in the code?

    BEdesign

    (@bedesign)

    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.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Latest blog post in footer’ is closed to new replies.