Ethos - only dislay author on posts

Hi,

Noticed there is an option out of the box for meta on or off under “Blog” -> “Content” under customization.
I would like to display only the author instead of default category/author/date.
Referring to this post


is this the correct code I can input in child theme function php? And if so, do I leave the meta option on or off?

// 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%2$s</p>',
        $author
      );
    }

  }

Thanks for your help.

Hello Isabelle,

Thanks for posting in!

Please leave the meta option to “ON” and then use this PHP 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( __( 'by %s', '__x__' ), get_the_author() ) . '</span>';


    //
    // Output.
    //

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

  }

Please note that the code provided above only serves as a guide and is to help you in getting started so implementing it. Maintaining the code will be out of our support scope and for further maintenance for new possible versions of the theme that may cause the customization to break, you will need to hire a developer.

Best Regards.

Thank you.

Tried adding to child function php but comes up with error:
Something went wrong. Your change may not have been saved. Please try again.

Must be doing something wrong?

Hello Isabelle,

There are a missing endif; statement in your original post. Please update the code I gave and use this instead:

// Custom Ethos Entry Meta
// =============================================================================

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

    //
    // Author.
    //

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


    //
    // Output.
    //

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

  }
endif;
// =============================================================================

Please let us know if this works out for you.

Nope, still get error with endif;
Could there be a setting prohibiting edits to child from Wordpress?

Hi Isabelle,

I tried to access your website but unfortunately, the given login information does not work. But I tested the given code on my local installation and it worked with no problem. Here is the result:

Would you please kindly get back to use with the correct login info so that we can test and see why it is not working for you?

Thank you.

1 Like

So sorry. below is current login

Hello Isabelle,

I have logged in to your site and checked your Theme Editor in Appearance > Theme Editor. It does not allow any changes to be saved. You will need to log in to your FTP and manually edit the functions.php file in your child theme.

Kindly let us know how it goes;

1 Like

Sorry for the day in responding.
Assuming I can do this via cpanel as well?

And just curious why the Theme Editor doesn’t allow changes as it has not been an issue on other sites with X / child theme.

Hi Isabelle,

Yes, you can do that on your CPanel’s file manager as well.

And it could be part of your hosting’s security and it won’t allow file changes through web server, but allowed for ftp server.

Thanks!

1 Like

You were correct. We recently updated security and I had to have my ip whitelisted.
Was able to add code afterwards.

Thank you for helping. You guys/girls are awesome. :heart_eyes:

Glad it’s working now and you’re most welcome!

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