-
AuthorPosts
-
November 21, 2018 at 2:30 pm #1036066
Hello all
How can I change the post date of blog posts on the homepage?
I have written a function in the functions.php of the child theme, which outputs the modification date of the article. I would like to specify this instead of the creation date in the article overview. In which file do I have to add the function?
Thanks
JörgNovember 22, 2018 at 2:47 pm #1036524Hey Jörg,
This is the file you need to make changes in for the content slider that you’re using on the front page
/enfold/config-templatebuilder/avia-shortcodes/contentslider/contentslider.phpIf you need further assistance please let us know.
Best regards,
VictoriaNovember 22, 2018 at 5:33 pm #1036635Hey Victoria,
thanks for your answer. But I don’t found the code to change the post create date. I search for this HTML-Tag:<time class="slide-meta-time updated" itemprop="datePublished" datetime="2018-11-11T13:23:56+00:00">11. November 2018</time>
in the footer-Section from article (class=”slide-entry”)
I found these HTML-Tag in /enfold/config-templatebuilder/avia-shortcodes/postslider/postslider.php.
I have copied this PHP-File into my Enfold-Child-Theme and change the code but no changes are on the frontpage.
When I change this file in original enfold-theme-folder it works.
What am I doing wrong?Second question:
When I use get_post_modified_time() or get_post_modified_date()-Wordpress-function the date in the post-footer is the same in all posts (3. May 2018) but there is not the correct modified-date. The original code with get_the_time()-function places the correct create-date from the post.
How can I use the correct modified-date?Best regards,
Jörg- This reply was modified 5 years, 5 months ago by jaderbass. Reason: Second question added
November 29, 2018 at 12:23 am #1038774Hi,
Are you loading the short codes changed with the functions.php code, that can allow to edit ALB files?
Best regards,
BasilisNovember 29, 2018 at 5:03 pm #1039032Hi Basilis,
No, I do not change ALB files.
I have inserted the following function into the functions.php:
// Automatically insert change date in the post function j0e_change_date( $width_comma = true) { $artikel_erstellt = get_the_date('U'); $artikel_aktualisiert = get_post_modified_time('U'); // Only spend if update is older than one day if (($artikel_aktualisiert - $artikel_erstellt) > 86400){ $before = ''; if( true === $width_comma ) $before = ', '; return $before . 'aktualisiert am ' . get_the_modified_date('j. F Y'); } }
Now I would like the change date to appear under the overview of the most recent posts on the homepage. Currently, the overview displays the creation date. I found the place in the source code in the file
/enfold/config-templatebuilder/avia-shortcodes/postslider/postslider.php
.Then I copied this file to my child folder
/enfold-child/config-templatebuilder/avia-shortcodes/postslider/postslider.php
and changed this file as follows:Line 629:
$meta. = "<time class = 'slide-meta-time updated' $ markup>" .get_the_time (get_option ('date_format'), $ the_id). "</ time>";
exchanged with this code:
$meta. = "<time class = 'slide-meta-time updated' $ markup>". j0e_change_date (false). "</ time>";
But then only the same date is output for all posts.
December 4, 2018 at 11:42 pm #1041001Hi,
Yea, you need to make Enfold read that you load files from child theme!
Take a look here
https://kriesi.at/support/topic/loading-shortcode-templates-from-child-theme/Best regards,
Basilis -
AuthorPosts
- You must be logged in to reply to this topic.