I am new here, I do not have a ton of experience with PHP but if I have a correct block I can work the different functions. I have a static page, currently, I have it set to display 5 snippets of posts, we have a ton of them on this category, and I need this page to have a line of links with
Newest 1, 2, 3, ... Oldest ...
I cannot get it to display that...
My current code looks like this:
<?php while ( have_posts() ) : the_post(); ?>
<div class="title text-center">
<h1><strong><?php the_title();?></strong></h1>
<img src="<?php echo get_template_directory_uri(); ?>/images/title.png" title="title-line" alt="title-line">
</div>
<div id="no-more-tables" class="legel">
<?php the_content();?></div>
<?php
$posts = get_posts(array(
'posts_per_page' => 5,
'category'=>'13'
));
if( $posts ): ?>
<div>
<?php foreach( $posts as $post ):
setup_postdata( $post );
?>
What do I need to add in order to make it do that? I am looking at this example, but it is not making sense to me:
<?php if ( $the_query->have_posts() ) : ?>
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<?php the_title(); ?>
<?php the_excerpt(); ?>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
<?php else : ?>
<p><?php __('No News'); ?></p>
<?php endif; ?>
I would appreciate any suggestions you may have...