Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #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örg

    #1036524

    Hey 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.php

    If you need further assistance please let us know.
    Best regards,
    Victoria

    #1036635

    Hey 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
    #1038774

    Hi,

    Are you loading the short codes changed with the functions.php code, that can allow to edit ALB files?

    Best regards,
    Basilis

    #1039032

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

    #1041001

    Hi,

    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

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.