-
AuthorPosts
-
September 25, 2014 at 7:49 pm #325220
Hi there,
I’ve got a question about displaying a “Last modified on: ” date.
Is there a possibility to display an last modified on date somewhere on a single page?
Is there a possibility to display an last modified on date for the whole site somewhere on every page?
Kind regards, eagerly wainting for 3.0 :).
September 26, 2014 at 8:07 am #325428Hi m00n!
Thank you for using Enfold.
You can edit includes > loop-index.php. Add the the_modified_date function. Please refer to this link: http://codex.wordpress.org/Function_Reference/the_modified_date
Best regards,
IsmaelSeptember 26, 2014 at 10:22 am #325492Hi there,
Thanks for the response. I tried the following code:
<?php echo "<div><p>Last modified: <?php the_modified_date('F j, Y'); ?> at <?php the_modified_date('g:i a'); ?></p></div>"; ?>
I added it in loop-index.php but it shows up nowhere.
When i add it to footer.php. It only shows “Last Modified at .
September 26, 2014 at 11:06 am #325502This reply has been marked as private.September 26, 2014 at 4:08 pm #325660Hi!
Make sure to read the whole codex entry. It would not work in the footer because it isn’t in the loop. Otherwise add it to a variable (the values you want) then echo out those variables where needed.
Cheers!
DevinSeptember 29, 2014 at 9:12 am #326391Hi there,
Thanks for the responses. I can’t get it to work. Any further suggestions?
Greatly appreciated!
September 30, 2014 at 4:41 am #326969Hey!
There is no way to make it work in the footer:
This tag must be used within The Loop
http://codex.wordpress.org/Function_Reference/the_modified_date
Cheers!
JosueSeptember 30, 2014 at 11:24 am #327112Hi there,
I understand, but is there anyway to get it to work? I tried placing it in the loop, but i can’t get it to show up anywhere.
September 30, 2014 at 4:31 pm #327398Hi,
Open includes/loop-index.php and look for this:
echo '<span class="blog-author minor-meta">'.__('by','avia_framework')." "; echo '<span class="entry-author-link" '.avia_markup_helper(array('context' => 'author_name','echo'=>false)).'>'; echo '<span class="vcard author"><span class="fn">'; the_author_posts_link(); echo '</span></span>'; echo '</span>'; echo '</span>';
Add this line below:
echo "<span class='text-sep text-sep-cat'>/</span><span class='minor'>Last modified: ".get_the_modified_date('F j, Y')." at ".get_the_modified_date('g:i a')."</span>";
Regards,
JosueSeptember 30, 2014 at 6:35 pm #327501Hi Joshue, Thanks for your response.
Added the line, but nothing shows up.
Site consists of pages build with the page builder. I need the last modified date showing on every page. I’m not using a blog or portfolio feature. If possible showing the modified date on the bottom. (no footer/socket active).
September 30, 2014 at 7:34 pm #327537Hey!
Can you post a link to your blog?
Best regards,
JosueSeptember 30, 2014 at 7:46 pm #327540This reply has been marked as private.September 30, 2014 at 8:35 pm #327570Hey!
Try adding this at the very end of your theme / child theme functions.php file:
add_filter('avf_template_builder_content', 'add_modified_date', 10, 1); function add_modified_date($content = "") { $content .= "<div class='modified'>Last modified: ".get_the_modified_date('F j, Y')." at ".get_the_modified_date('g:i a')."</div>"; return $content; }
Cheers!
JosueSeptember 30, 2014 at 9:37 pm #327609Hi there,
Thanks Joshue, we are getting there. Modified date is finally showing. Anyway to get it (floating)outside the main content? Floating to the left of browser window.
I’m trying to get it to work with CSS but it won’t budge :).
- This reply was modified 10 years, 1 month ago by m00n.
September 30, 2014 at 10:33 pm #327655Hi!
This could work, use this code instead:
add_action('wp_footer', 'add_modified_date', 10); function add_modified_date() { echo "<div class='modified'>Last modified: ".get_the_modified_date('F j, Y')." at ".get_the_modified_date('g:i a')."</div>"; }
Best regards,
JosueSeptember 30, 2014 at 10:39 pm #327665Thanks Joshue, that did the trick!
Awesome support!
September 30, 2014 at 10:40 pm #327668You are welcome, glad to help :)
Regards,
Josue -
AuthorPosts
- The topic ‘DIsplaying last modified date’ is closed to new replies.