[Resolved] author not displaying on single post page

Home Forums Support author not displaying on single post page

  • This topic has 11 replies, 2 voices, and was last updated 4 months ago by Leo.
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #1511424
    Linda

    I have searched the forum and reviewed similar questions but I can’t seem to figure out why the author is not showing on the single post page. On my front page I am using WP Show Posts and the author appears there, but when you click to see main post, the author is not there. Any ideas appreciated, thanks.

    #1511453
    Leo
    Staff
    Customer Support
    #1511499
    Linda

    Yes, as far as I can see!
    Screenshot 2020-10-30 121206.jpg

    #1511520
    Leo
    Staff
    Customer Support

    Looks like you are using some custom functions for the entry meta.

    Can you share the code here?

    Let me know πŸ™‚

    #1511539
    Linda

    Using 2 snippets, 1 of 2 here

    //https://docs.generatepress.com/article/generate_post_date_output/#remove-link-from-date
    //This code will remove the published date HTML if an updated date exists.

    add_filter( 'generate_post_date_output', function( $output, $time_string ) {
        $time_string = '<time class="entry-date published" datetime="%1$s" itemprop="datePublished">%2$s</time>';
    
        $updated_time = get_the_modified_time( 'U' );
        $published_time = get_the_time( 'U' ) + 86400;
    
        if ( $updated_time > $published_time ) {
            $time_string = '<time class="entry-date updated-date" datetime="%3$s" itemprop="dateModified">%4$s</time>';
        }
    
        $time_string = sprintf( $time_string,
            esc_attr( get_the_date( 'c' ) ),
            esc_html( get_the_date() ),
            esc_attr( get_the_modified_date( 'c' ) ),
            esc_html( get_the_modified_date() )
        );
    
        return sprintf( '<span class="posted-on">%s</span> ',
            $time_string
        );
    }, 10, 2 );
    #1511540
    Linda

    Snippet 2 of 2 here:

    add_filter( 'wpsp_date_output', 'tu_wpsp_updated_date_first' );
    function tu_wpsp_updated_date_first() {
    	$time_string = '';
    	
    	if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
    		$time_string .= '<time class="wp-show-posts-updated" datetime="%3$s" itemprop="dateModified">%4$s</time>';
    	}
    	
    	$time_string .= '<time class="wp-show-posts-entry-date published" datetime="%1$s" itemprop="datePublished">%2$s</time>';
    	
    	$time_string = sprintf( $time_string,
    		esc_attr( get_the_date( 'c' ) ),
    		esc_html( get_the_date() ),
    		esc_attr( get_the_modified_date( 'c' ) ),
    		esc_html( get_the_modified_date() )
    	);
    	
    	// If our date is enabled, show it
    	$output = sprintf(
    		'<span class="wp-show-posts-posted-on wp-show-posts-meta">
    			<a href="%1$s" title="%2$s" rel="bookmark">%3$s</a>
    		</span>',
    		esc_url( get_permalink() ),
    		esc_attr( get_the_time() ),
    		$time_string
    	);
    
    	return $output;
    	
    }
    #1511556
    Linda

    Also sending login info to my (sloppy) staging site

    #1511789
    Leo
    Staff
    Customer Support

    Can you remove the first function first?

    Let me know πŸ™‚

    #1511798
    Linda

    Removing first one, then both of the snippets caused no change in the single post page (after clicking on the read more)

    #1511848
    Leo
    Staff
    Customer Support

    Can you first clear and disable all the caching plugins you are using?

    #1512509
    Linda

    I did try removing the caching plugin, but it had no effect.
    However, I did get it working after much trial and error, but don’t ask me why it now works, maybe because it’s Halloween? I have this plugin installed, https://wordpress.org/plugins/wp-last-modified-info/. I made no changes except to save (again) the settings in that plugin. Now the author name shows up. It’s a mystery, but at least it’s working. Thanks so much for helping me troubleshoot!

    #1512624
    Leo
    Staff
    Customer Support
Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.