Site logo

Archived topic

Include php code on static page using GP sections ... ?

4 replies · Started by lock-e73 on June 17, 2015

Viewing posts 1–5 of 5

Hi,
Just a quick question, and again I apologise if it's been asked or answered before! I'm creating a static landing page using the GP sections plugin and was wondering how I go about including the most recent blog post in one of the sections? I've tried adding the following code but it essentially comments the php out.

<?php
 global $post;
 $myposts = get_posts('numberposts=1&category=3');
 foreach($myposts as $post) :
 ?>
 <?php the_title(); ?>
 <?php the_content(); ?>
 <?php endforeach; ?>

Any help would be very much appreciated!
Thanks,
lock-e73

Hi Tom,

Ah, that would explain a lot! :)

Thanks for the pointer to the plugin. I'd actually had a look at that one as well as this one - - which also includes shortcodes and ability to customise with CSS. Will have a bit more of a play with both and see what I can do.

Once again thanks for your quick response!

Cheers,
lock-e73

That's a good one as well, but requires a widget area unless you use a plugin like "Widget Shortcode".

This archived topic is closed to new replies.