-

Displaying posts using a WordPress shortcode
Every now and again I like to change the look of my blog by using a different WordPress theme. Inevitably there’s tinkering required, but I’m a sucker for tinkering! My latest theme change (to the Apostrophe 2 theme) was to a magazine-style blog. Anyone landing on the home page has to click individual posts to see the contents of the post, then return to the home page, and then click on the next post. My son was critical of this but I did point out that followers of my blog don’t normally visit the home page as they simply get notified of a new post and go directly to the post and its contents.But having previously investigated WordPress shortcodes, I knew there was a way of answering my son’s criticism. So now he can simply select from the blog menu the menu item “Most recent blog posts”. This opens up a blog page listing the 5 most recent posts, in full and one after the other.
To create this solution, all that’s necessary is for the blog owner to create a new page, give it a title like ‘Recent posts’, and then add the new page to the blog menu. The new page needs to contain the following text on the page:
[ display-posts include_date=”true” include_content=”true” wrapper=”div” posts_per_page=”5″ ]
This will display in full the 5 most recent posts. Of course you can change 5 to whatever number you like up to a maximum of 100 (WordPress limitation).
In reality I wasn’t too happy with the results produced by this simple code. I wanted to alter the format of the displayed date and time and I also wanted to separate the individual posts in a more pronounced way.
The solution involves adding code to display the most recent post, followed by a separator, followed by the next most recent post, followed by a separator, etc etc. Here is the code, without further explanation, to display the 5 most recent posts with a separator between each post.
[ display-posts include_date=”true” date_format=” (D, j M Y @ g:i a)” include_content=”true” wrapper=”div” posts_per_page=”1″ offset=”0″ ]
< hr style=”width: 80%; height: 8px;” / >
[ display-posts include_date=”true” date_format=” (D, j M Y @ g:i a)” include_content=”true” wrapper=”div” posts_per_page=”1″ offset=”1″ ]
< hr style=”width: 80%; height: 8px;” / >
[ display-posts include_date=”true” date_format=” (D, j M Y @ g:i a)” include_content=”true” wrapper=”div” posts_per_page=”1″ offset=”2″ ]
< hr style=”width: 80%; height: 8px;” / >
[ display-posts include_date=”true” date_format=” (D, j M Y @ g:i a)” include_content=”true” wrapper=”div” posts_per_page=”1″ offset=”3″ ]
< hr style=”width: 80%; height: 8px;” / >
[ display-posts include_date=”true” date_format=” (D, j M Y @ g:i a)” include_content=”true” wrapper=”div” posts_per_page=”1″ offset=”4″ ]
Good luck!
No comments on Displaying posts using a WordPress shortcode -

A working life
A working life (with a few imaginative job titles):- News media delivery agent
- Meat delivery agent
- Factory inventory recorder
- Software engineer – space research, energy supply, marketing, communication hardware, system software
- PC / network support analyst
- Database & IT support manager
- Fundraising database manager
- Book reader (unpaid)
-

I could eat a horse
Three years and four months old Chloe seems linguistically advanced for her age. The expressions and sentences she sometimes comes out with are a constant surprise. But maybe she’s just demonstrating how rapid the development of language skills is and at how early an age this occurs.I’ve recently introduced her to the hyperbolic expressions “I could eat a horse” and “It’s raining cats and dogs”. She dismisses them out of hand. “Nooo, don’t be silly, grandad!” she responds. I’ve explained when one uses them (“I’m really, really hungry” and “It’s raining really heavily”) but she persists in taking them at face value and dismissing them as preposterous. I’m going to persevere and I’m confident that before long she’ll use one of the expressions.
-

A new life for Scarborough sun chalets?

-

Just another rainbow
-

Classic Boat Festival & Great River Race
-

A violent night sky
I’m not sure if this an accurate representation of the striking night sky, but it’s the best I could do. And no, there was no rain or storm.
-

London South Bank / Tate Modern
When I began my walk on the South Bank, at around 11am, it was surprisingly quiet. Usually this part of London is teeming with tourists, walkers and joggers. Even the beach was empty!My intended destination was the huge Tate Modern building. The Turbine Hall was being prepared for what looked like an event rather than the usual display / exhibition.

Before tackling any museum or gallery it’s my firm belief that an energy boost is required.

There is a wonderful viewing gallery on the 10th floor of the new wing of Tate Modern.
Below, a heavily photoshopped panorama from the Tate Modern viewing gallery is followed by a more normal panorama of the Thames.

And finally, a colourful shot of Blackfriars Bridge with St Paul’s in the background, from where I caught my train home.
-

The beauty of Inspector Montalbano
Last night’s terrific episode of the glorious Inspector Montalbano had the usual array of beautiful women, though not quite so many stunning views. Here are a few screenshots from this episode (A Nest of Vipers).
-

You know what’s coming….










