Changing Post Meta Data

Hi I saw this CSS code on another support thread:
.p-meta span:nth-child(1),
.p-meta span:nth-child(2):after,
.p-meta span:nth-child(3),
.p-meta span:nth-child(4) {
display: none;
}

It allows only the date to be shown. How can I alter this CSS to only show the author?

Thanks!

Hello @larry1,

Thanks for asking. :slight_smile:

Please change the code with following: and add under Pro > Theme Options > CSS:

.p-meta span:nth-child(2), .p-meta span:nth-child(3), .p-meta span:nth-child(4), .p-meta span:nth-child(1) a, .meta-comments, .p-meta>span:after {
display: none;
}

1- I have found the proper CSS code selector using the Chrome browser Developer Toolbar: https://www.youtube.com/watch?v=wcFnnxfA70g

2- For the CSS code itself, I suggest that you get started with this tutorial: https://www.youtube.com/watch?v=yfoY53QXEnI

Thanks.

Thanks! Almost there… it still contains “In” before the author name. I fiddled with the CSS but can’t get that to go away. What do I need to do? See screen capture.

Hello There,

The css is not a great solution for your issue. The css you added will only work with other stack. Since you are using Ethos, you need a different approach. Please do the following to resolve your issue.

  • Please remove the custom css that you added.
  • Since the child theme is set up, please add the following code in your child theme’s functions.php file
// Custom Ethos Entry Meta
// =============================================================================

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

    //
    // Author.
    //

    $author = sprintf( ' %1$s %2$s</span>',
      __( 'by', '__x__' ),
      get_the_author()
    );


    //
    // Output.
    //

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

  }
endif;

We would loved to know if this has work for you. Thank you.

Hi, Yes this did the trick. Thank you. I’m not sure I have my child theme set up correctly however. I only saw the functions.php file in my X Pro theme folder. But when placed in that file it worked.

Hello There,

The code must be added in the child theme’s functions.php file because what you are trying to accomplish requires a template customization. We would highly suggest that you use a child theme. This allows you to make code changes that won’t be overwritten when an X update is released.

You may check or edit your child theme’s functions.php file in Appearance > Editor or manually by browsing the themes folder in wp-content/themes/pro-child/

Hope this helps.

Thanks it does clear it up a little for me. If you can’t tell I’ve very new to this theme (and Wordpress in general). Is there a safe & easy way to create the child theme at this point as my site is pretty far along in the design?
Thanks!

Hi Larry,

If you did not modify any of the parent theme template, then It should be safe switching from parent Pro to Pro child.

Cheers,

Thank you. I’ll give it a try.

Glad we could help, let us know how it goes,

Cheers!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.