Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1026644
    JurgaR
    Participant

    Hello,
    Since a few days I see this on my blog posts’ meta data: %s Comments
    It used to be just category, author and date, so I have no idea why this reappeared?
    Maybe it has something to do with the update?

    Could you please help me in getting rid of it? 🙂
    Thanks, Jurga

    Full Suitcase Travel Blog

    #1027166
    Nico
    Moderator

    Hey There,

    Thanks for writing in.

    Latest, update, X 4.5.2 should fix it.

    Update Guide: https://community.theme.co/kb/updating-your-theme-and-plugins/

    Thanks.

    #1027692
    JurgaR
    Participant

    Thanks I updated and the% sign is gone. However I still see full meta data on each post.

    I have this code in CSS (see below) and before the previous update I could see just the author and the date (no category, no comments). NOW in categories I see only date for each of my posts, which is ok. But once I click on the post, I see everything: category, author, date, number of comments. How can I change the CSS again to get rid of the category and the comments? It’s strange that this would change by itself after the update…
    Thanks a lot for your help!

    .blog .p-meta > span:first-child, .blog .p-meta > span:last-child {
    display: none;
    }

    .blog .p-meta > span:nth-child(2):after {
    display: none;
    }

    .category .p-meta > span:first-child, .category .p-meta > span:last-child {
    display: none;
    }

    .category .p-meta > span:nth-child(2):after {
    display: none;
    }

    #1027844
    Lely
    Moderator

    Hi There,

    Thanks for posting in.
    Above CSS code will only work for category pages and blog index page. That will not work on the single post page, that’s why you’re seeing category and comments. To hide those meta on single pages, please also add the following CSS:

    .single .p-meta > span:first-child, .single .p-meta > span:last-child {
    display: none;
    }
    
    .single .p-meta > span:nth-child(2):after {
    display: none;
    }

    Hope this helps.

    #1027846
    Christopher
    Moderator

    Hi there,

    Please update your code to :

     .p-meta > span:first-child, .p-meta > span:last-child,.p-meta > span:nth-child(2):after,.p-meta > span:first-child,  .p-meta > span:last-child,.p-meta > span:nth-child(2):after  {
    display: none;
    }
    
    

    Hope it helps.

    #1027874
    JurgaR
    Participant

    Thanks to both! 🙂 Now all info is gone, except for the date. Is it possible to show the date and the author name? I only wanted to hide category and comments.
    Thanks a lot!

    #1028038
    Christian
    Moderator

    Hey Jurga,

    Please remove all the CSS given previously and add the code below in your functions.php

    function x_ethos_entry_meta() {
    
      //
      // Author.
      //
    
      $author = sprintf( ' %1$s %2$s</span>',
        __( 'by', '__x__' ),
        get_the_author()
      );
    
      //
      // Date.
      //
    
      $date = sprintf( '<span><time class="entry-date" datetime="%1$s">%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 ) )
                                . '"> '
                                . $category->name
                                . '</a>'
                                . $separator;
          }
    
          $categories_list = sprintf( '<span>%1$s %2$s',
            __( 'In', '__x__' ),
            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 ) )
                              . '"> '
                              . $category->name
                              . '</a>'
                              . $separator;
        }
    
        $categories_list = sprintf( '<span>%1$s %2$s',
          __( 'In', '__x__' ),
          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() );
    
        $text = ( 0 === $number ) ? 'Leave a Comment' : _n( '%s Comment', '%s Comments', $number, '__x__' );
    
        $comments = sprintf( '<span><a href="%1$s" title="%2$s" class="meta-comments">%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</p>',
          $author,
          $date
        );
      }
    
    }

    Hope that helps. 🙂

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