• Resolved PaulDoesWP

    (@pauldoeswordpress)


    Hello,
    I was hoping to use this plugin to just display the latest post in a widget. I’ve tweaked my functions.php file and added a shortcode to a text widget, but it only displays the post’s header, not its content. And it’s in a really small font. I guess I can tweak the CSS quite easily to change the font, but how do I make it display the content of the post?

    The documentation for this plugin is almost non-existent; the header image on this plugin page hints that somewhere there is a “Basic Tutorial” for this plugin, but no such tutorial seems to exist! I’ve searched through the not-very-helpful single wiki page and your website to no avail. Am I looking in the wrong places?

    Thanks,

    Paul

    https://wordpress.org/plugins/display-posts-shortcode/

Viewing 1 replies (of 1 total)
  • Thread Starter PaulDoesWP

    (@pauldoeswordpress)

    I went ahead and uninstalled this plugin and found something online that I adapted for my needs; it creates a shortcode called [newestpost]:

    function wp_recentpost($atts, $content=null){
    $getpost = get_posts( array('number' => 1) );
    $getpost = $getpost[0];
    $return = "<h1>" . $getpost->post_title . "</h1>" . $getpost->post_content . "…";
    $return .= "<br /><a href='" . get_permalink($getpost->ID) . "'><em>read more →</em></a>";
    return $return;
    }
    add_shortcode('newestpost', 'wp_recentpost');

    – Paul

Viewing 1 replies (of 1 total)
  • The topic ‘Display the contents of the latest post’ is closed to new replies.