Latest Posts Shortcode Documentation
Suppose you have a Page in WordPress with some company information, and you wanted to display some recent blog posts within it. Or maybe you have a FAQ section and you wanted to display some excerpts of other important items. The ‘Latest’ shortcode was created to remedy this problem and bring more dynamic content into your pages with minimal effort.
Below is a list of the accepted parameters for the “Latest” shortcode and some examples to help you get started.
Source:
/*-----------------------------------------------------------------------------------*/ // // Latest Posts // Shortcode Parameters: // /*-----------------------------------------------------------------------------------*/ // excerpt="true|false" ------ display the excerpt or 'more' tag break // length="50" ------ excerpt character length // thumbs="true|false" ------ display featured thumbnail // width="50" ------ featured thumbnail width // cols="2" ------ split the results into X number of columns (4 max) // height="50" ------ featured thumbnail height // num="6" ------ number of entries to display // cat="1,-2" ------ categories to include or exclude (-) // morelink="Read More..." ------ more link text // offset="0" ------ offset/skip X number of posts // type="page|post" ------ query type // parent="1" (page only) ------ page parent // orderby="date|customfield" ------ custom ordering // order="ASC|DESC" ------ sort order /*-----------------------------------------------------------------------------------*/ // Example: [latest excerpt="true" thumbs="true" width="50" height="50" num="5" cat="8,10,11"] /*-----------------------------------------------------------------------------------*/
Example Using Columns
The example below shows how to use the latest shortcode to display your content within a set number of columns. If you’d like to use some of your own custom markup inside the shortcode, but still want to use columns, see the advanced example further below.
The Code
[latest excerpt="true" thumbs="true" length="50" morelink="Read More »" width="75" height="75" num="6" cols="2" cat="4,5,1"]
The Result
We All Have Valleys To Walk Through
If you’re an experience designer, design an experience
How to successfully validate your idea with a Landing Page MVP
Creative People Say No
How iPads Are Changing the Education Industry
The Optimal Post is 7 Minutes
Advanced Example
Below is a more advanced example combined with the adaptive fractional columns shortcode, using custom markup within the shortcode.
Latest Posts from Category A
We All Have Valleys To Walk Through
Latest Posts from Category B
If you’re an experience designer, design an experience
Latest Posts from Category C
Creative People Say No
Interrupting Paragraph
This paragraph is interrupting the columns, but we can continue below using the offset parameter! Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.
[break]
Latest Posts from Category A
How to successfully validate your idea with a Landing Page MVP
Latest Posts from Category B
The Optimal Post is 7 Minutes
Latest Posts from Category C
The Future of Digital Products is in Storytelling
Source of Above Output
[one_third] <h4 class="sub">Latest Posts from Category A</h4> [latest excerpt="true" thumbs="true" length="50" morelink="Read More »" width="75" height="75" num="1" cat="8"] [/one_third] [one_third] <h4 class="sub">Latest Posts from Category B</h4> [latest excerpt="true" thumbs="true" length="50" morelink="Read More »" width="75" height="75" num="1" cat="8" offset="1"] [/one_third] [one_third_last] <h4 class="sub">Latest Posts from Category C</h4> [latest excerpt="true" thumbs="true" length="50" morelink="Read More »" width="75" height="75" num="1" cat="8" offset="2"] [/one_third_last] [clearfade] <div class="cta"> <h4 class="sub">Interrupting Paragraph</h4> <p>This paragraph is interrupting the columns, but we can continue below using the offset parameter! Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.</p> </div> [break] [clearfade] [one_third] <h4 class="sub">Latest Posts from Category A</h4> [latest excerpt="true" thumbs="true" length="50" morelink="Read More »" width="75" height="75" num="1" cat="8" offset="3"] [/one_third] [one_third] <h4 class="sub">Latest Posts from Category B</h4> [latest excerpt="true" thumbs="true" length="50" morelink="Read More »" width="75" height="75" num="1" cat="8" offset="4"] [/one_third] [one_third_last] <h4 class="sub">Latest Posts from Category C</h4> [latest excerpt="true" thumbs="true" length="50" morelink="Read More" width="75" height="75" num="1" cat="8" offset="5"] [/one_third_last]