Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1074431
    nyckidd
    Participant

    Hello,

    I would like to be able to select author A to be seen on the article meta, BUT if it is Author B i dont want them to be shown in the meta…i have the following in my child theme functions file..

    //
        // Author.
        //
        $author = sprintf( 'Posted by %s   ',
          ( function_exists( 'coauthors' ) && is_singular('post') ) ? coauthors_posts_links() : get_the_author()
        );
    #1074502
    Paul R
    Moderator

    Hi,

    Thanks for writing in!

    Can you provide us the entire code in your functions.php file.

    #1074692
    nyckidd
    Participant

    Sure…its in my child theme

    <?php
    
    // =============================================================================
    // FUNCTIONS.PHP
    // -----------------------------------------------------------------------------
    // Overwrite or add your own custom functions to X in this file.
    // =============================================================================
    
    // =============================================================================
    // TABLE OF CONTENTS
    // -----------------------------------------------------------------------------
    //   01. Enqueue Parent Stylesheet
    //   02. Additional Functions
    // =============================================================================
    
    // Enqueue Parent Stylesheet
    // =============================================================================
    
    add_filter( 'x_enqueue_parent_stylesheet', '__return_true' );
    
    // Additional Functions
    // =============================================================================
    
    // Entry Meta
    // =============================================================================
    
    if ( ! function_exists( 'x_integrity_entry_meta' ) ) :
      function x_integrity_entry_meta() {
    
        //
        // Author.
        //
        $author = sprintf( 'Posted by %s   ',
          ( function_exists( 'coauthors' ) && is_singular('post') ) ? coauthors_posts_links() : get_the_author()
        );
    
       
        //
        // 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() )
        );
    
        //
        // Output.
        //
    
        if ( x_does_not_need_entry_meta() ) {
          return;
        } else {
          printf( '<p class="p-meta">%2$s%3$s%4$s</p>',
            $author,
            $date,
            $categories_list,
            $comments
          );
        }
    
      }
    endif;
    
    // limit word count in excerpt
    
    function excerpt_count_js(){
    
    if ('page' != get_post_type()) {
    
          echo '<script>jQuery(document).ready(function(){
    jQuery("#postexcerpt .handlediv").after("<div style=\"position:absolute;top:12px;right:34px;color:#666;\"><small>Excerpt length: </small><span id=\"excerpt_counter\"></span><span style=\"font-weight:bold; padding-left:7px;\">/ 227</span><small><span style=\"font-weight:bold; padding-left:7px;\">character(s).</span></small></div>");
         jQuery("span#excerpt_counter").text(jQuery("#excerpt").val().length);
         jQuery("#excerpt").keyup( function() {
             if(jQuery(this).val().length > 227){
                jQuery(this).val(jQuery(this).val().substr(0, 227));
            }
         jQuery("span#excerpt_counter").text(jQuery("#excerpt").val().length);
    
       });
    });</script>';
    }
    }
    add_action( 'admin_head-post.php', 'excerpt_count_js');
    add_action( 'admin_head-post-new.php', 'excerpt_count_js');
    
    // show all categories on page using a shortcode
    
    function show_categories_fn(){
      return wp_list_categories("echo=0&title_li");
    }
    add_shortcode('show_categories', 'show_categories_fn');
    #1075291
    Rad
    Moderator

    Hi there,

    The code simply displays one author, though, I can’t confirm if it’s Author A or B, would you mind providing a sample URL that displays Author A and B?

    Thanks!

    #1076666
    nyckidd
    Participant
    This reply has been marked as private.
    #1076856
    Rahul
    Moderator

    Hey There,

    That is a function not included out of the box with X. That can either be achieved by a plugin or custom development. Regretfully, implementing it falls outside the scope of our support. You might want to contact our trusted partners who caters X setup and customization needs. Please see https://theme.co/x/member/custom-development/.

    Thank you for understanding.

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