Answer the question
In order to leave comments, you need to log in
How to display all posts except the first one in WordPress?
Hello! I don't know much about PHP and WordPress yet and I'm learning them in parallel. I could not find the answer to the question in Google, so I hope for your help)
There is a function that receives an array of records of the 'services' type. Recorded, as expected, in functions.php:
function getFaq(){
$args = array(
'orderby' => 'date',
'order' => 'ASC',
'post_type' => 'services',
);
return get_posts( $args );
}
<div class="twelve columns">
<?php foreach(getFaq() as $post): ?>
<h1><?php echo $post->post_title; ?><span>.</span></h1>
<hr />
<p><?php echo $post->post_content; ?></p>
<?php break; endforeach; ?>
</div>
<?php foreach(getFaq() as $post): ?>
<div class="bgrid">
<h3><?php echo $post->post_title; ?></h3>
<div class="service-content">
<p><?php echo $post->post_content; ?></p>
</div>
</div>
<?php endforeach; ?>
<?php foreach(getFaq() as $post):
if(!getFaq()[0]){ ?>
<div class="bgrid">
<h3><?php echo $post->post_title; ?></h3>
<div class="service-content">
<p><?php echo $post->post_content; ?></p>
</div>
</div>
<?php } endforeach; ?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question