Why is not displayed time around? WordPress

I have this link:

http://www.dg-design.ch/blog/page/2/

Read More

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.

enter image description here

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!

Related posts

4 comments

  1. Please check the screenshot and check whether the setting is properly done or not.
    enter image description here

  2. 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.

  3. @Shashank Singh

    Linked to a crucial thing though.

    — Use Below for Single Post Page —

    Here is a print of the function in Question.

    function the_date( $d = '', $before = '', $after = '', $echo = true ) {
        global $currentday, $previousday;
    
        if ( $currentday != $previousday ) {
            $the_date = $before . get_the_date( $d ) . $after;
            $previousday = $currentday;
    
            /**
             * Filter the date a post was published for display.
             *
             * @since 0.71
             *
             * @param string $the_date The formatted date string.
             * @param string $d        PHP date format. Defaults to 'date_format' option
             *                         if not specified.
             * @param string $before   HTML output before the date.
             * @param string $after    HTML output after the date.
             */
            $the_date = apply_filters( 'the_date', $the_date, $d, $before, $after );
    
            if ( $echo )
                echo $the_date;
            else
                return $the_date;
        }
    
        return null;
    }
    

    Params:

    $d

    (string) (Optional) PHP date format defaults to the date_format option if not specified.
    
    Default value: ''
    

    $before

    (string) (Optional) Output before the date.
    
    Default value: ''
    

    $after

    (string) (Optional) Output after the date.
    
    Default value: ''
    

    $echo

    (bool) (Optional) default is display. Whether to echo the date or return it.
    
    Default value: true
    

    https://developer.wordpress.org/reference/functions/the_date/

    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 and get_the_ are meant to be treated has data.

Comments are closed.