Jump to content


Photo
- - - - -

Best way to insert latest post into a page


This topic has been archived. This means that you cannot reply to this topic.
9 replies to this topic

#1 quinntinm

quinntinm

    Super Member

  • Members
  • 121 posts

Posted 12 September 2012 - 12:02 PM

Hi there.
what is the best way to insert a latest post into a page without using a sidebar widget?
I want to add the lastest post to a home page which is not the blog home page.

thanks.

#2 catrina

catrina

    Advocate

  • Members
  • 12345 posts

Posted 12 September 2012 - 02:23 PM

Try using the function and shortcode here (under "Most Recent Post"):

Please Login or Register to see this Hidden Content



But first, please check to make sure that you're using either base theme or the PL Customize Plugin (you'll need to insert the function into the bottom of the functions.php file in either one). If not, let us know and we'll direct you.

#3 quinntinm

quinntinm

    Super Member

  • Members
  • 121 posts

Posted 12 September 2012 - 02:54 PM

Hi Catrina, thanks for this.
I am using the Pagelines framework - not sure if that is the base theme?

#4 catrina

catrina

    Advocate

  • Members
  • 12345 posts

Posted 12 September 2012 - 03:08 PM

You'll need to install the base theme. On your Dashboard, go to PageLines > Store > Themes > Free and the Base theme should be at the top. Install it and then activate it in Appearance > Themes.

#5 quinntinm

quinntinm

    Super Member

  • Members
  • 121 posts

Posted 12 September 2012 - 03:26 PM

Why must i activate it - i have already customised the framework which i activated:


Current Theme

PageLines Framework
  • By

    Please Login or Register to see this Hidden Content

  • Version 2.2.5
A responsive drag-and-drop platform for professional websites based on HTML5 and CSS3. PageLines will help you do amazing things faster & easier than ever before. Designed by

Please Login or Register to see this Hidden Content

in California. Twitter @pagelines</p>

#6 catrina

catrina

    Advocate

  • Members
  • 12345 posts

Posted 12 September 2012 - 03:32 PM

The base theme doesn't affect what you've already set up. It's simply a child theme that inherits the characteristics of the parent theme, PageLines Framework. For more insight, please see here:

Please Login or Register to see this Hidden Content



#7 quinntinm

quinntinm

    Super Member

  • Members
  • 121 posts

Posted 12 September 2012 - 03:50 PM

Hi Catrina, ok, i have done all of that, works like a charm, thanks so much.

A quick question about formatting (It all comes in as text without any <h1> etc).

In the code below, i have highlighted what i assume i must add to target the headline etc, but i am not a programmer so am not sure about the ""'s etc.

Is the code below correct?

function wptuts_recentpost($atts, $content=null){
$getpost = get_posts( array('number' => 1) );
$getpost = $getpost[0];
$return = $getpost->"<h3>"post_title ."</h3>" "<br />" . $getpost->post_excerpt . "…";
$return .= "<br /><a href='" . get_permalink($getpost->ID) . "' target=_blank><em>read more →</em></a>";

return $return;
}
add_shortcode('newestpost', 'wptuts_recentpost');



Thanks so much for the help!

#8 catrina

catrina

    Advocate

  • Members
  • 12345 posts

Posted 12 September 2012 - 04:18 PM

Are you just trying to style the <h3> heading?

#9 quinntinm

quinntinm

    Super Member

  • Members
  • 121 posts

Posted 12 September 2012 - 04:59 PM

Pretty much, yes.
That and to make the link open in a new window.

#10 catrina

catrina

    Advocate

  • Members
  • 12345 posts

Posted 12 September 2012 - 05:28 PM

Can you please post a link to your site?