Support » Theme: Spacious » Related Posts: how to hide post author

  • Resolved Carl Gross

    (@carlgross)


    Hello. I’ve enabled your Related Posts feature, and it is now displaying related posts as expected. But one piece of information it displays is the post author (screenshot). I would like for this section to not display the post author. Does the theme perhaps have a filter hook I can use to ensure the post author is not rendered in this case?

    I realize I can hide the post author with custom CSS, and that will be my fallback option. But for now I’m wondering how I might use a PHP approach.

    Thanks.

    • This topic was modified 6 months, 3 weeks ago by Carl Gross.
Viewing 8 replies - 1 through 8 (of 8 total)
  • @carlgross

    You can create a child theme and edit inc/related-posts.php file as required for your site.

    Thanks.

    OK I understand, thanks. But is there a filter hook I can use instead of copying a file to my child theme? That would be the preferred method, if it was available.

    • This reply was modified 6 months, 3 weeks ago by Carl Gross.

    @carlgross

    No, it is not available.

    Thanks.

    What about, instead of copying the file from parent theme to child, I use the_author filter hook to ensure it returns a blank string in the related posts section? Wouldn’t that accomplish what I want? The <span> element would still be present in the DOM, but it would be blank, right?

    @carlgross

    Yes, that method should work out too. But displaying an empty tag might not be a better approach. However, if you want the same then, you can do so and see if that helps.

    Thanks.

    OK yes, that’s a good point, thanks. In light of that, I will probably stick with editing the theme file.

    Also though, let’s say I actually went with the the_author() hook approach. I know how to use that hook to return a blank string. But in my PHP code, how would I ensure a blank string is returned only when the_author() is used in the Spacious ‘related posts’ section?

    @carlgross

    No, taking that only on account is not possible at all since that is WordPress function and we utilized it and changing the way it is to be made within your site, will effect in everyplace where that function is used up since there in this function usage, there is no any special hooks added for such feature as you asked for within the theme.

    Thanks.

    OK thanks. In light of that, I’ve gone with the ‘editing the PHP template’ approach. Thanks for the help. We can consider this resolved.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Related Posts: how to hide post author’ is closed to new replies.