Hi,
I have a PHP script that was written by somebody else but I need to edit, it displays the latest issue of a magazine on Wordpress.
What I need to do is show the 2 previous posts, excluding the most recent. So change the posts per page to 2, and then exclude the current post.
It's probably quite simple but I'm no PHP expert as yet.
Here is the script -
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<main id="main">
<section id="latest-edition">
<div class="row">
<?php
$args = array(
'post_type' => 'cpt_issue',
'post_status' => 'publish',
'posts_per_page' => 1,
'orderby' => 'date',
'order' => 'DESC'
);
if($issues = get_posts($args)):
foreach($issues as $issue):
list($src,$w,$h) = wp_get_attachment_image_src(get_post_thumbnail_id($issue->ID),'full');
?>
Thanks for your help in advance,
Rory