Remove author tag and tags from posts

Tried a few versions of functions.php but without success. Do you mind providing me with the correct code to remove this, not hide. CSS hide is not what I want. I want to remove it.

Thanks

Hi There,

1 . Please add this code under functions.php file locates in your child theme:

function x_renew_entry_meta() {

    //
    // 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>%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 ) )
                            . '">'
                            . $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() );


    $text = ( 0 == $number ) ? __( 'Leave a Comment', '__x__' ) : sprintf( _n( '%s Comment', '%s Comments', $number, '__x__' ), $number );


    $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%3$s</p>',
        $date,
        $categories_list,
        $comments
      );
    }

}

2 . Please create a new _content.php file in the child theme directory x-child/framework/views/global/ (if the directories isn’t existed > create new) with the following code:

<?php

// =============================================================================
// VIEWS/GLOBAL/_CONTENT.PHP
// -----------------------------------------------------------------------------
// Display of the_excerpt() or the_content() for various entries.
// =============================================================================

$stack                     = x_get_stack();
$is_full_post_content_blog = is_home() && x_get_option( 'x_blog_enable_full_post_content' ) == '1';

?>

<?php

if ( is_singular() || $is_full_post_content_blog ) :
  x_get_view( 'global', '_content', 'the-content' );
else :
  x_get_view( 'global', '_content', 'the-excerpt' );
endif;

?>

Hope it helps :slight_smile:

Many thanks!! Worked perfectly expect the moth tag see print in private notes. Could you provide me with a solution for that one as well?

Hi there,

I am not sure if this is what you want but you can simply go to X > Launch > Options > Blog > Content and disable the Meta Options:

That should do the trick.

Would be awesome but no that didn’t change anything (yes cleared all instances of cache).

Hello There,

The screenshots you have provided is no longer viewable.

Do you want to place the date only? If that is the case, please have the code updated and use this:

function x_renew_entry_meta() {

    //
    // 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() )
    );


    //
    // Output.
    //

    if ( x_does_not_need_entry_meta() ) {
      return;
    } else {
      printf( '<p class="p-meta">%1$s</p>',
        $date
      );
    }

}

And if you want to change the date format, you may change it in Settings > General > Date Format. For more information, please check this out: https://codex.wordpress.org/Formatting_Date_and_Time

Hope this helps.

No, I want all removed see print and page in the secure note, thanks

Hi,

Disabling post meta under X > Launch > Options > Blog > Content should work.

Would you mind providing us your wordpress admin login in Secured Note

If not please replace the code provided above with this.

function x_renew_entry_meta() {
return;
}

Thanks

Added to functions.php no changes. I do have the code that thai sent since it removed everything else.

Hi,

Can you provide us your ftp login in Secure Note. I would like to check the code in your child theme’s function.php and also would like to test some code.

Thanks

We don’t use FTP so it needs to be access to cpanel whcih is in secure note:

Hi,

I went ahead and replaced the code in your functions.php with this.

function x_renew_entry_meta() {
return;
}

Please check in your end.

Thanks

Perfect! You added it to the child, right?

Can you share the full code for functions.php and _content.php so that I can save it internally for the future. Since we are using PRO on most of our sites.

Hi There,

All the changes under your child theme. _content.php file can be located under
/wp-content/themes/x-child/framework/views/global/
and functions.php file can be located under
/wp-content/themes/x-child/

Hope that helps.

No? I asked only for the full code stack. He changed the code in functions.php yes but is that code the only code needed for all these changes. Send the full solution and I will save it for the future thanks :slight_smile:

Hi there,

I am not sure what you mean but are you looking for the full code that is supposed to be in the function x_renew_entry_meta?

If so, here it is:

if ( ! function_exists( 'x_renew_entry_meta' ) ) :
  function x_renew_entry_meta() {

    //
    // Author.
    //

    $author = sprintf( '<span>%s</span>',
      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>%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 ) )
                            . '">'
                            . $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() );


	  $text = ( 0 == $number ) ? __( 'Leave a Comment', '__x__' ) : sprintf( _n( '%s Comment', '%s Comments', $number, '__x__' ), $number );


	  $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%3$s%4$s</p>',
        $author,
        $date,
        $categories_list,
        $comments
      );
    }

  }
endif;

Hope this helps.

No no,

Let paul answer instead of adding new people to this thread every single time. I want the code that solved my issue. Go back and read the thread. If you´re not able to do that forget it.

Hi there,

Unfortunately, Paul is not available at the moment. We can not guarantee a single person for the answers.

I tried to access both your dashboard or the CPanel but could not get in. You should simply go to:

wp-content/themes/x-child/functions.php

And you will see the full stack code. Same thing for the other file. I tried to access there to be able to show you here the code but I could not get in.

Thank you.

We can’t let “random” have access to our server or sites. I can’t upload the whole functions.php to another site. Just want this code and I will find it just thought it was very easy for him to reply and done.

Never mind then

Hi there,

If you are looking for the code that solved your issue then you can simply find them in your functions.php as your issue will not get solved if the code is not there in the first place.

Have a nice weekend.