Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #194673
    CynthiaAllen
    Participant

    We have multiple authors on our blog. Unfortunately, the author is not displaying at all even though we are showing the entire post.

    I have poked around quite a bit and can’t find a place to activate display of the author and/or their picture.

    Thanks.

    #194674
    CynthiaAllen
    Participant

    Oh
    Icon is the stack.

    #195327
    Darshana
    Moderator

    Hi there,

    Thanks for writing in! We have the [author] shortocode that you can use to display author info. Please refer to the following link for detailed information (http://theme.co/x/demo/icon/1/shortcodes/author/).

    Hope that helps.

    #195376
    CynthiaAllen
    Participant

    Thanks.

    But I don’t understand where to put the short code. There is no obvious place for that in the User Profile.

    We don’t want to have to manually list it every time.

    #195621
    CynthiaAllen
    Participant

    I am currently manually putting the short code into each post. Now that I started doing this, the blog roll I set up to list only individual authors on their pages isn’t working. Now all posts are listed even though the widget says to pull only one author.

    #195848
    Zeshan
    Member

    Hi there,

    Thanks for writing in!

    If you wish to show the author profile automatically below each single post page, this will require a template change. Because this requires a template change, I’d advise that you setup a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices.

    After that, simply add following code in your child theme’s functions.php file:

    // Author Field below the post content - Single page only.
    // =============================================================================
    
    add_filter( 'the_content', 'custom_author_code');
    
    function custom_author_code($content) {
       if ( is_single() ) {
          return $content . do_shortcode('[author title="About the Author"]');
       } else {
          return $content;
       }
    }
    

    Hope this helps. 🙂

    Thank you.

    #757769
    josephjbaranowski
    Participant

    Awesome, but how do I display the full name and not the username on not only the post but the blog post page

    http://nobleapplications.com/wp/blog/
    http://nobleapplications.com/wp/2016/01/15/mobile-app-use-across-industry-lines/

    #758349
    Paul R
    Moderator

    Hi,

    To display full name on your blog aang single posts, please add the code below in your child theme’s functions.php file

    
    function x_shortcode_author_v2( $atts ) {
      extract( shortcode_atts( array(
        'id'        => '',
        'class'     => '',
        'style'     => '',
        'title'     => '',
        'author_id' => ''
      ), $atts, 'x_author' ) );
    
      $id        = ( $id        != '' ) ? 'id="' . esc_attr( $id ) . '"' : '';
      $class     = ( $class     != '' ) ? 'x-author-box cf ' . esc_attr( $class ) : 'x-author-box cf';
      $style     = ( $style     != '' ) ? 'style="' . $style . '"' : '';
      $title     = ( $title     != '' ) ? $title : __( 'About the Author', csl18n() );
      $author_id = ( $author_id != '' ) ? $author_id : get_the_author_meta( 'ID' );
    
      $description  = get_the_author_meta( 'description', $author_id );
      $display_name = get_the_author_meta( 'first_name', $author_id )." ".get_the_author_meta( 'last_name' , $author_id);
      $facebook     = get_the_author_meta( 'facebook', $author_id );
      $twitter      = get_the_author_meta( 'twitter', $author_id );
      $googleplus   = get_the_author_meta( 'googleplus', $author_id );
    
      $facebook_output   = ( $facebook )   ? "<a href=\"{$facebook}\" class=\"x-author-social\" title=\"Visit the Facebook Profile for {$display_name}\" target=\"_blank\"><i class=\"x-icon-facebook-square\" data-x-icon=\"\"></i> Facebook</a>" : '';
      $twitter_output    = ( $twitter )    ? "<a href=\"{$twitter}\" class=\"x-author-social\" title=\"Visit the Twitter Profile for {$display_name}\" target=\"_blank\"><i class=\"x-icon-twitter-square\" data-x-icon=\"\"></i> Twitter</a>" : '';
      $googleplus_output = ( $googleplus ) ? "<a href=\"{$googleplus}\" class=\"x-author-social\" title=\"Visit the Google+ Profile for {$display_name}\" target=\"_blank\"><i class=\"x-icon-google-plus-square\" data-x-icon=\"\"></i> Google+</a>" : '';
    
      $output = "<div {$id} class=\"{$class}\" {$style}>"
                . "<h6 class=\"h-about-the-author\">{$title}</h6>"
                . get_avatar( $author_id, 180 )
                . '<div class="x-author-info">'
                  . "<h4 class=\"h-author mtn\">{$display_name}</h4>"
                    . $facebook_output
                    . $twitter_output
                    . $googleplus_output
                  . "<p class=\"p-author mbn\">{$description}</p>"
                . '</div>'
              . '</div>';
    
      return $output;
    }
    
    add_action('wp_head', 'change_x_author_to_v2');
    
    function change_x_author_to_v2() {
        remove_shortcode( 'recent_posts' );
        add_shortcode( 'recent_posts', 'x_shortcode_author_v2' );
    }
    
    function x_integrity_entry_meta() {
    
        //
        // Author.
        //
    
        $author = sprintf( '<span><i class="x-icon-pencil" data-x-icon=""></i> %1$s %2$s</span>',
           get_the_author_meta( 'first_name' ),
            get_the_author_meta( 'last_name' )
        );
    
        //
        // Date.
        //
    
        $date = sprintf( '<span><time class="entry-date" datetime="%1$s"><i class="x-icon-calendar" data-x-icon=""></i> %2$s</time></span>',
          esc_attr( get_the_date( 'c' ) ),
          esc_html( get_the_date() )
        );
    
        //
        // Categories.
        //
    
        if ( get_post_type() == 'x-portfolio' ) {
          if ( has_term( '', 'portfolio-category', NULL ) ) {
            $categories        = get_the_terms( get_the_ID(), 'portfolio-category' );
            $separator         = ', ';
            $categories_output = '';
            foreach ( $categories as $category ) {
              $categories_output .= '<a href="'
                                  . get_term_link( $category->slug, 'portfolio-category' )
                                  . '" title="'
                                  . esc_attr( sprintf( __( "View all posts in: &ldquo;%s&rdquo;", '__x__' ), $category->name ) )
                                  . '"><i class="x-icon-bookmark" data-x-icon=""></i> '
                                  . $category->name
                                  . '</a>'
                                  . $separator;
            }
    
            $categories_list = sprintf( '<span>%s</span>',
              trim( $categories_output, $separator )
            );
          } else {
            $categories_list = '';
          }
        } else {
          $categories        = get_the_category();
          $separator         = ', ';
          $categories_output = '';
          foreach ( $categories as $category ) {
            $categories_output .= '<a href="'
                                . get_category_link( $category->term_id )
                                . '" title="'
                                . esc_attr( sprintf( __( "View all posts in: &ldquo;%s&rdquo;", '__x__' ), $category->name ) )
                                . '"><i class="x-icon-bookmark" data-x-icon=""></i> '
                                . $category->name
                                . '</a>'
                                . $separator;
          }
    
          $categories_list = sprintf( '<span>%s</span>',
            trim( $categories_output, $separator )
          );
        }
    
        //
        // Comments link.
        //
    
        if ( comments_open() ) {
    
          $title  = apply_filters( 'x_entry_meta_comments_title', get_the_title() );
          $link   = apply_filters( 'x_entry_meta_comments_link', get_comments_link() );
          $number = apply_filters( 'x_entry_meta_comments_number', get_comments_number() );
    
          if ( $number == 0 ) {
            $text = __( 'Leave a Comment' , '__x__' );
          } else if ( $number == 1 ) {
            $text = $number . ' ' . __( 'Comment' , '__x__' );
          } else {
            $text = $number . ' ' . __( 'Comments' , '__x__' );
          }
    
          $comments = sprintf( '<span><a href="%1$s" title="%2$s" class="meta-comments"><i class="x-icon-comments" data-x-icon=""></i> %3$s</a></span>',
            esc_url( $link ),
            esc_attr( sprintf( __( 'Leave a comment on: &ldquo;%s&rdquo;', '__x__' ), $title ) ),
            $text
          );
    
        } else {
    
          $comments = '';
    
        }
    
        //
        // Output.
        //
    
        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 that helps.

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