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

  • HI,
    sorry but all of this requires file modification and additional code which we do not support.
    Those are the default wordpress post options.
    thanks
  • 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
  • Hi,
    ofcrourse you can add it, just use a child theme and modify it in your liking. Then it will not change upon theme updates.
    thanks
  • 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.