I have this link:
http://www.dg-design.ch/blog/page/2/
CODE PHP:
<?php while ( have_posts() ) : the_post(); ?>
<?php if( $wp_query->current_post == 0 ){ ?>
<li class="block first-post">
<a href="<?php the_permalink(); ?>" class="fancybox-iframe"><?php the_post_thumbnail('vantage-grid-loop'); ?></a>
<h3><a href="<?php the_permalink(); ?>" class="fancybox-iframe"><?php the_title(); ?></a></h3><br><p class="italic"><?php the_date(); ?></p>
<p><?php echo substr(get_the_content(),0,600).'...'; ?></p>
</li>
<?php } else if( $wp_query->current_post > 0 && $wp_query->current_post < 5 ) { ?>
<li class="block">
<a href="<?php the_permalink(); ?>" class="fancybox-iframe"><?php the_post_thumbnail('blog'); ?></a>
<h3><a href="<?php the_permalink(); ?>" class="fancybox-iframe"><?php echo substr(get_the_title(),0,20).'...'; ?></a></h3><br>
<p class="italic"> <?php the_date(); ?></p>
<p><?php echo substr(get_the_content(),0,70).'...'; ?></p>
</li>
<?php } else { ?>
<li class="block">
<a href="<?php the_permalink(); ?>" class="fancybox-iframe"><?php the_post_thumbnail('blog'); ?></a>
<h3><a href="<?php the_permalink(); ?>" class="fancybox-iframe"><?php the_title(); ?></a></h3><br>
<p class="italic"><?php the_date(); ?></p>
<p><?php echo substr(get_the_content(),0,600).'...'; ?></p>
</li>
<?php } ?>
<?php //get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>
I put a picture to understand better what they want.
On the first page of the blog, and the date is displayed on the remaining pages is not shown and do not understand why.
You can help me solve this problem?
Thanks in advance!
Please check the screenshot and check whether the setting is properly done or not.
You need to write get_the_date() to get the date for the posts. Now you to have place this code in file which is responsible to show the other post around.
When there are multiple posts on a page published under the SAME DAY, the_date() only displays the date for the first post.
Please Read this
@Shashank Singh
Linked to a crucial thing though.
— Use Below for Single Post Page —
Here is a print of the function in Question.
Params:
$d
$before
$after
$echo
So in order to work you would need to do something like
the_date('','<p class="italic">, '</p>');
— Important note —
Remember that prefix function
the_
are meant to be displayed andget_the_
are meant to be treated has data.