-
AuthorPosts
-
November 3, 2024 at 7:35 pm #1470510
Is it possible for all blog posts to have a line at the bottom showing the date it was updated? Where the date automatically updates when the post is updated?
November 4, 2024 at 6:13 am #1470538Hey gatehealing,
Thank you for the inquiry.
Which blog layout did you select? Please provide the link to the page so we can check it.
Best regards,
IsmaelNovember 4, 2024 at 7:08 am #1470539Clarification: I mean each individual post, not the blog page that shows all posts
Enfold Child > Blog Layout > Blog Styling > Modern Business
Enfold Child > Blog Layout > Blog Layout > Use Advanced Layout Editor to build your own (but I cannot use ALE once I’m in there because I use the ALE for my Pages, so I’m forced to use the Default Editor for each post . . . I still do not understand why I cannot use ALE on both, but I know that it breaks something)Enfold Child > Blog Layout > Single Post with Big Preview Image
Within each post > Format > Standard
November 4, 2024 at 7:25 am #1470544Hi,
Thank you for the update.
Try to use this filter in the functions.php file to display the modification date:
function avf_custom_post_slider_meta_content( $meta_content, $entry, $index, $atts, $meta_array ) { $updated_date = get_the_modified_date( 'F j, Y', $entry->ID ); $meta_array[] = '<div class="updated-date">Updated: ' . esc_html( $updated_date ) . '</div>'; $meta_content = implode( '<div class="slide-meta-del">/</div>', $meta_array ); return $meta_content; } add_filter( 'avf_post_slider_meta_content', 'avf_custom_post_slider_meta_content', 10, 5 );
Best regards,
IsmaelNovember 4, 2024 at 8:53 am #1470547Wow – thats nice – only if you like to get your desired MM/DD/YYYY – you should change the date format to :
'm/d/Y'
______________
or if you like to have the same date format as the setting of your wordpress installation:function avf_custom_post_slider_meta_content( $meta_content, $entry, $index, $atts, $meta_array ) { $updated_date = get_the_modified_date( get_option('date_format') , $entry->ID ); $meta_array[] = '<div class="updated-date">Updated: ' . esc_html( $updated_date ) . '</div>'; $meta_content = implode( '<div class="slide-meta-del">/</div>', $meta_array ); return $meta_content; } add_filter( 'avf_post_slider_meta_content', 'avf_custom_post_slider_meta_content', 10, 5 );
November 4, 2024 at 9:22 am #1470549here just a Question concerning to this – how to avoid showing on blog the date and comment count?
The “Blog Meta Elements” show option only is working for the single blog post. Not for the blog. There the time is always displayed.
is it because of ? :$show_meta_time = apply_filters( 'avf_postslider_posts_meta_data_show', true, 'time', $index, $entry, $this );
same on comments. But having a child-theme postslider.php with these settings to false – will only disable time showing – but comments are still there. ?
Edit: i only looked to the normal blog page that is created by wordpress. If i use the blog-post alb – it will have influence on both.
Sorrybut nevertheless : Is there a way to have a child-theme solution to show/hide these metas on blog? And not having a child-theme postslider.php
November 4, 2024 at 10:36 am #1470551Next Question : we got the filter for masonry entries: avf_masonry_loop_entry_content
Is it possible to add via that filter new loop keys ( like the above updated date f.e.) ?__________
Edit : perhaps not the most elegant method – but it works on masonry entry – and i have to find a way to only influence Masonry Entries and not masonry galleries.function avf_custom_masonry_loop_prepare( $key, $entries ) { $separator = ' / '; $updated_date = get_the_modified_date( get_option('date_format') , $key['ID'] ); $output .= '<span class="updated-date meta-color av-masonry-date">'.$separator.'Updated on: ' . esc_html( $updated_date ) . '</span>'; $key['text_after'] .= trim( $output, $separator ); return $key; } add_filter( 'avf_masonry_loop_prepare', 'avf_custom_masonry_loop_prepare', 10, 2 );
November 5, 2024 at 3:58 am #1470611Sent this to my host (Dream host): After typing in the code in Appearance > Theme File Editor > functions.php, I hit Update File button and get this error: “Unable to communicate back with site to check for fatal errors, so the PHP change was reverted. You will need to upload your PHP file change by some other means, such as by using SFTP.” and got this reply:
“Thank you for contacting DreamHost Support, my name is Brandon. I’m sorry
to hear you’re having issues with WordPress, but I’ll be happy to help
you out today. Unfortunately in this case would need to consult with the
theme developers as its their custom code causing this issue and they
would need to provide you with different code to add.”November 5, 2024 at 6:16 am #1470616Hi,
Thank you for the update.
Did you copy the code from your email? Please try to restore the previous functions.php file, copy the code directly from this forum, then paste it to the functions.php file. Let us know if this works for you.
Thank you for the info @Gueni007.
Best regards,
IsmaelNovember 5, 2024 at 6:31 am #1470618I copied it directly from here. It never saved it in the functions.php, so I didn’t need to restore the original. When I went back to look at it, the new code wasn’t there.
Putting login info in private box if y’all would like to take a look.
Thanks!
JonPS just tried it again with the same result
- This reply was modified 1 month, 2 weeks ago by gatehealing.
November 5, 2024 at 6:42 am #1470620did you enter this in the functions.php of the parent theme? (unfortunately all this would be lost again after the next update).
this is possible – but my recommendation is to use a child theme.November 5, 2024 at 6:44 am #1470621No, to the child
November 5, 2024 at 6:47 am #1470622but you kept the first line of the functions.php of the child theme (
<?php
)
or is there another function named avf_custom_post_slider_meta_content?
(function names had to be unique)so the snippets couldn’t be the reasons for that – i always test them :
https://webers-testseite.de/blog/. and for masonry: https://webers-testseite.de/masonry-blog/November 5, 2024 at 8:20 am #1470635Hi,
@gatehealing: We get the same error when we add the code in the functions.php file. Have you tried adding this via SFTP?how do i hamper the masonry-gallery to do that too. – i see that switch( $entry->post_type ) on line 1049 but can not bring it to a working snippet inclusion ( by case post or portfolio ).
@Guenni007: What do you mean? The callback for the avf_masonry_loop_prepare filter that you posted above seems to be correct.Best regards,
IsmaelNovember 5, 2024 at 8:32 am #1470636Yes – but Masonry Galleries are influenced too. I do not want image galleries to be part of that additional info.
Only Masonry Entries should be doing that. I tried$context == 'av_masonry_entries'
but again with no success.
https://webers-testseite.de/image-masonry/November 5, 2024 at 8:40 am #1470638Hi,
Only Masonry Entries should be doing that. I tried $context == ‘av_masonry_entries’ but again with no success.
Have you tried checking if the item is a post, attachment or media?
Example:
$post_type = get_post_type( $key['ID'] ); if ($post_type === 'attachment') { // masonry gallery } else // post }
Best regards,
IsmaelNovember 5, 2024 at 8:45 am #1470640the filter allows those two : (
$key, $entries
)
thats why i tried :
if($key['post_type'] == ('post' || 'portfolio' )) { … }
November 5, 2024 at 8:49 am #1470641this seems to work:
function avf_custom_masonry_loop_prepare( $key, $entries ) { if($key['post_type'] != 'attachment') { $separator = ' / '; $updated_date = get_the_modified_date( get_option('date_format') , $key['ID'] ); $output .= '<span class="updated-date meta-color av-masonry-date">'.$separator.'Updated on: ' . esc_html( $updated_date ) . '</span>'; $key['text_after'] .= trim( $output, $separator ); } return $key; } add_filter( 'avf_masonry_loop_prepare', 'avf_custom_masonry_loop_prepare', 10, 2 );
i do not know why the positiv check does not work ( case post or portfolio)
Edit :
i thought that thisif($key['post_type'] == 'post' || $key['post_type'] == 'portfolio') { // could be shortend to: if($key['post_type'] == ('post' || 'portfolio')) {
first one works – shortform not
November 5, 2024 at 8:50 am #1470642Hi!
@Guenni007: This seems to work:function avf_custom_masonry_loop_prepare( $key, $entries ) { $separator = ' / '; $updated_date = get_the_modified_date( get_option('date_format') , $key['ID'] ); $output .= '<span class="updated-date meta-color av-masonry-date">'.$separator.'Updated on: ' . esc_html( $updated_date ) . '</span>'; $post_type = get_post_type( $key['ID'] ); if ($post_type !== 'attachment') { $key['text_after'] .= trim( $output, $separator ); } return $key; } add_filter( 'avf_masonry_loop_prepare', 'avf_custom_masonry_loop_prepare', 10, 2 );
Best regards,
IsmaelNovember 5, 2024 at 8:55 am #1470644thanks – now i got it.
November 5, 2024 at 9:05 pm #1470705wait . . . is this latest stuff for me? ie should I try that last block of code?
JonNovember 6, 2024 at 12:13 am #1470711So the original code works when I add it in via sftp but it adds it to the Blog page, not to the bottom of the individual posts themselves, which is what I’m going for.
November 6, 2024 at 6:16 am #1470732Hi,
wait . . . is this latest stuff for me? ie should I try that last block of code?
@gatehealing: Sorry for the confusion. For single post, you may have to directly modify the includes > loop-index.php or use this filter in the functions.php file.add_filter('avf_post_metadata_array', function($meta, $context) { global $post; if($context == 'loop-index') { $updated_date = get_the_modified_date('F j, Y', $post->ID); $meta['updated_date'] = '<span class="blog-updated-date minor-meta">Updated on: ' . $updated_date . '</span>'; } return $meta; }, 10, 2);
Best regards,
IsmaelNovember 6, 2024 at 9:37 am #1470745But this works only for: non-ALB generated Posts / even Portfolios are untouched.
November 6, 2024 at 10:06 am #1470748Hi!
@guenn007i: I think he’s using the default editor.
Enfold Child > Blog Layout > Blog Layout > Use Advanced Layout Editor to build your own (but I cannot use ALE once I’m in there because I use the ALE for my Pages, so I’m forced to use the Default Editor for each post . . . I still do not understand why I cannot use ALE on both, but I know that it breaks something)
// https://kriesi.at/support/topic/append-all-blog-posts-with-updated-mm-dd-yyyy/#post-1470539
Regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.