WordPress.org

Forums

A small code question, help. (1 post)

  1. neologan
    Member
    Posted 3 years ago #

    this is some code in a plugin, so if this all works:

    $output .= '<h2><a href="' . get_permalink($post) . '">' . $post->post_title . '</a></h2><p class="homesinfoportal">';
    
            if ($author) {
            $output .=  __('Posted by: ', 'posts-by-tag') ;
            $output .=  get_the_author_meta('display_name', $post->post_author) ;
                        }
    
            if ($date) {
            $output .=  __('on ', 'posts-by-tag');
            $output .=  mysql2date(get_option('date_format'), $post->post_date) . ' at ' ;
    	$output .=  mysql2date(get_option('time_format'), $post->post_date) . '<span class="thetimes"> ' ;

    What would be the correct way to make this work:

    $output .= human_time_diff(get_the_time('U'), current_time('timestamp')) . ' ago </span></p>' ;

    Hoping someone has a better eye than me :)

Topic Closed

This topic has been closed to new replies.

About this Topic