Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1283638
    peterdavidgrant
    Participant

    Hi there,

    I’m building a site offline (using MAMP), and have a problem relating to Authors.

    Using ICON and the masonry blog post page, I’d like to show the Author along with date. I’ve managed this by adding the following to my child theme functions.php:

    // Entry Meta
    // =============================================================================
    
    if ( ! function_exists( 'x_icon_entry_meta' ) ) :
      function x_icon_entry_meta() {
    
       
        $author = sprintf( '<span><i class="x-icon-pencil"></i> %s</span>',
          get_the_author()
        );
    
        $date = sprintf( '<span><time class="entry-date" datetime="%1$s"><i class="x-icon-calendar"></i> %2$s</time></span>',
          esc_attr( get_the_date( 'c' ) ),
          esc_html( get_the_date() )
        );
    
        if ( x_does_not_need_entry_meta() ) {
          return;
        } else {
          printf( '<p class="p-meta">%1$s%2$s%3$s%4$s</p>',
            $author,
            $date,
            $categories_list,
            $comments
          );
        }
    
      }
    endif;

    How ever, what I’m after is the author being clickable, and showing a page with all of their posts, e.g. it would take me to: http://localhost:8888/author/peter-david-grant/ when clicked.

    Thanks,
    Peter

    #1284057
    Rupok
    Member
    #1284185
    peterdavidgrant
    Participant

    Hi Rupok,

    Thank you for the reply.

    I checked out those two links, but the code doesn’t seem to work, and it removes the author that I managed to get displayed. See attached image.

    Thanks again!

    #1284188
    peterdavidgrant
    Participant

    oops. sorry I’ve attached basically the same image twice! Sorry. The second was meant to be a blog post view.

    #1284233
    Christopher
    Moderator

    Hi there,

    Would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:

    – Link to your site
    – WordPress Admin username / password
    – FTP credentials

    Don’t forget to select Set as private reply. This ensures your information is only visible to our staff.

    Thanks.

    #1284956
    peterdavidgrant
    Participant

    Hi Christopher,

    Unfortunately my site is only local at the moment, waiting for someone else to set me up with the hosting package. I’ll update this support page after it’s online with the details.

    Thanks,
    Peter

    #1285232
    Lely
    Moderator

    Ok then Peter. We will get back to you once we have those details so we can check further.

    #1304714
    peterdavidgrant
    Participant
    This reply has been marked as private.
    #1304743
    Thai
    Moderator

    Hi There,

    Please update your code to this:

    function x_icon_entry_meta() {
    
    	global $post;
    	$author = sprintf( '<a href="%1$s"><span><i class="x-icon-pencil"></i> %2$s</span></a>',
    		get_author_posts_url( $post->post_author ),
    		get_the_author()
    	);
    
    	$date = sprintf( '<span><time class="entry-date" datetime="%1$s"><i class="x-icon-calendar"></i> %2$s</time></span>',
    	  esc_attr( get_the_date( 'c' ) ),
    	  esc_html( get_the_date() )
    	);
    
    	if ( x_does_not_need_entry_meta() ) {
    	  return;
    	} else {
    	  printf( '<p class="p-meta">%1$s%2$s%3$s%4$s</p>',
    	    $author,
    	    $date,
    	    $categories_list,
    	    $comments
    	  );
    	}
    
    }

    Hope it helps 🙂

  • <script> jQuery(function($){ $("#no-reply-1283638 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>