• Resolved libby_ct

    (@libby_ct)


    Hi
    I am using the shortcode to display the posts within the structure of a page but it does not display the date of the post. Is that possible?

Viewing 2 replies - 1 through 2 (of 2 total)
  • I would like to know that as well.

    Plugin Author Eric Amundson

    (@sewmyheadon)

    Hi @libby_ct and @apfotos,

    I am using the shortcode to display the posts within the structure of a page but it does not display the date of the post. Is that possible?

    Absolutely. You’ll just need to edit your posts_loop_template.php file. Before you do, copy it from the plugin into your active theme directory.

    Once you copy that file to your theme directory, if you open it, you may see something like:

    <!-- Post Wrap Start-->
    <div class="post hentry ivycat-post">
    	
    	<!-- 	This outputs the post TITLE -->
    	<h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    
    <!-- 	This outputs the post EXCERPT.  To display full content including images and html, 
    		replace the_excerpt(); with the_content();  below. -->
    	<div class="entry-summary">
    		<?php the_excerpt(); ?>
    	</div>
    
    	<!--	This outputs the post META information -->
    	<div class="entry-utility">
    		<?php if ( count( get_the_category() ) ) : ?>
    			<span class="cat-links">
    				<?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'posts-in-page' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?>
    			</span>
    			<span class="meta-sep">|</span>
    		<?php endif; ?>
    		<?php
    			$tags_list = get_the_tag_list( '', ', ' );
    			if ( $tags_list ):	?>
    			<span class="tag-links">
    				<?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'posts-in-page' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?>
    			</span>
    			<span class="meta-sep">|</span>
    		<?php endif; ?>
    		<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'posts-in-page' ), __( '1 Comment', 'posts-in-page' ), __( '% Comments', 'posts-in-page' ) ); ?></span>
    		<?php edit_post_link( __( 'Edit', 'posts-in-page' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
    	</div>
    </div>
    <!-- // Post Wrap End -->

    To add the date, you’ll want to figure out where in the template you’d want it to show and then most likely add the function: <a href="https://codex.www.ads-software.com/Template_Tags/the_time">the_time()</a>.

    Here’s a link to the Formatting Date and Time Codex page.

    Let’s say you wanted to add “This entry was posted on Friday, September 24th, 2004” right before the_excerpt(), you might add the following snippet of code in the posts_loop_template.php file above the_excerpt():

    <p>This entry was posted on <?php the_time('l, F jS, Y') ?></p>

    Make sure that you make the changes in the posts_loop_template.php folder you copied to your theme (assuming you haven’t renamed the file).

    With the above changes, the guts of your posts_loop_template.php file might look like this:

    <!-- Post Wrap Start-->
    <div class="post hentry ivycat-post">
    	
    	<!-- 	This outputs the post TITLE -->
    	<h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    
    	<!-- 	This outputs the DATE and TIME -->
    	<p>This entry was posted on <?php the_time('l, F jS, Y') ?></p>
    
    	<!-- 	This outputs the post EXCERPT.  To display full content including images and html, 
    		replace the_excerpt(); with the_content();  below. -->
    	<div class="entry-summary">
    		<?php the_excerpt(); ?>
    	</div>
    
    	<!--	This outputs the post META information -->
    	<div class="entry-utility">
    		<?php if ( count( get_the_category() ) ) : ?>
    			<span class="cat-links">
    				<?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'posts-in-page' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?>
    			</span>
    			<span class="meta-sep">|</span>
    		<?php endif; ?>
    		<?php
    			$tags_list = get_the_tag_list( '', ', ' );
    			if ( $tags_list ):	?>
    			<span class="tag-links">
    				<?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'posts-in-page' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?>
    			</span>
    			<span class="meta-sep">|</span>
    		<?php endif; ?>
    		<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'posts-in-page' ), __( '1 Comment', 'posts-in-page' ), __( '% Comments', 'posts-in-page' ) ); ?></span>
    		<?php edit_post_link( __( 'Edit', 'posts-in-page' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
    	</div>
    </div>
    <!-- // Post Wrap End -->

    I hope that helps!

    Eric

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Show date’ is closed to new replies.