Forum has been created to help all our customers in properly working our theme. We offer complete help with configuration theme and make default look, just like on our Be|theme demo. We don`t offer theme customization.


Before creating a new discussion, please:
1. Check on forum if discussion hasn`t been created before. Use the forum Search on the right.
2. Read carefully the documentation included to package.
3. If you didn`t find what you need and would like to post a new question click the "Start a New Discussion" button on the right.
4. You can post on forum only after registration (you need purchase code to register) .


NOTE!!! If you are starting a new topic and have got problems with your site and you want us to check what`s wrong please always give url to your site because without that we can`t check what`s wrong. Each case may be different because of your installed plugins, servers or other things.


IMPORTANT!!! Along with your inquiry, please attach the address of the page which concerns the question. This will cause the time to answer on your question will be much shorter. If you do not want to publish your address publicly in the forum, please send a private message. Thanks!

Add post meta

Hi Guys,

We have a couple of sites running on betheme with one of them being a big blog site. Although most people want the post meta (author, date, category) to be removed, on this site we want to show it the following meta data when reading a post:
- date
- date last modified
- amount of time needed to read it (via plugin, can use a shortcode)

Now, date (created/published) is working obviously, but is it possible to add the last modified date of that post, to the post meta? Same goes for the plugin shortcode.

Many thanks in advance, best regards,
Niels

Comments

  • Please sign in to see answear!
  • Hi,

    My client keeps requesting this so I am forced to look into this again.

    It seems that wordpress does know the modified date. For Example, Jetpack adds it as an opengraph tag:
    <meta property="article:published_time" content="2016-10-02T10:30:41+00:00" />
    <meta property="article:modified_time" content="2018-01-09T14:10:16+00:00" />

    From the post source it's the following code:
    <div class="post-meta clearfix">
        <div class="author-date">
            <span class="date">
                <i class="icon-clock"></i>
                <time class="entry-date updated" datetime="2016-10-02T12:30:41+00:00" itemprop="datePublished" >2 oktober 2016</time>
                <meta itemprop="dateModified" content="2016-10-02T12:30:41+00:00"/>
            </span>
        </div>
    </div>


    This comes from the content-post.php, starting at line 156:

    if( isset( $list_meta['date'] ) ){
        $output .= '<span class="date">';    
            if( isset( $list_meta['author'] ) ) $output .= '<span class="label">'. $translate['at'] .' </span>';    
            $output .= '<i class="icon-clock"></i> ';    
            $output .= '<span class="post-date updated">'. get_the_date() .'</span>';    
        $output .= '</span>';
    }


    To me, it doesn't seem to hard to add an extra line which outputs the modified date and time. I could add this myself but ofcourse this would not survive an update from the theme (which is working perfect since this is integrated with Wordpress updates!) Combine this with a switch in the Betheme options and you've added a functionality which is used on many blogs these days.

    It would be greatly appreciated if you can look into this again, and if you agree with me on this then please add this feature in upcoming theme updates.

    Many thanks in advance, best regards,
    Niels
  • Please sign in to see answear!
  • For those who are wondering, I added the following code to content-single.php (wp-content/themes/betheme/includes/):

                                                <?php if( get_the_modified_time('U') >= get_the_time('U') + 86400 ) : ?>
                                                <span>- last modified: </span>
                                                <time class="entry-date modified" datetime="<?php echo get_the_modified_time('c'); ?>" itemprop="dateModified" ><?php echo get_the_modified_date(); ?></time>
                                                <?php endif; ?>


    underneath: <?php if( isset( $single_meta['date'] ) ): ?>
    which is the code for showing the published date.

    It probably isn't the most beautifull solution but I've hardly done any programming in php so I'm happy with it. Btw, it checks whether it has been more than 24 hours before showing the last modified date.


    To muffin support, it would be really could if you can turn this in a betheme future.
Sign In or Register to comment.