Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6340805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:54:20+00:00 2026-05-24T19:54:20+00:00

I am building a child theme in WordPress that needs some custom functionality (for

  • 0

I am building a child theme in WordPress that needs some custom functionality (for an example, I want to show an author bio on things in the ‘fiction’ category, but not in the ‘fiction-contest’ category, though they otherwise look the same).

It seems that no matter how specific my templates are, eventually I run into one of two things:

the_content();

or

get_template_part( 'content', get_post_format() );

This is the part I want to have finer control over. Yet it seems I can only grab content as a big chunk. My workaround has been to style parts of the content as “display: none”, depending on the template being used, but is there a way to conditionally change actual content returned by the above code? If so, how and where would I do that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T19:54:21+00:00Added an answer on May 24, 2026 at 7:54 pm

    the_content() should return only the post contents. The author information should not be included unless the author explicitly listed it within the post.

    I believe you are looking for something along the lines of:

    <?php
    
        // This array can contain category IDs, names, or slugs.
        // I went with an array for the ability to easily extend in the future.
        $cats_for_bio = array(
            "Fiction",
            "OtherCategory"
        );
    
        if ( in_category($cats_for_bio) ) {
    
            // You need to get the author id since we are outside of the loop.
            $authorID = $posts[0]->post_author;
    
            // Place your bio output code here as you please.
            // This example just grabs the author name and description.
    
            $authorName = get_the_author_meta("first_name", $authorID) . " ";
            $authorName .= get_the_author_meta("last_name", $authorID);
    
            $authorDesc = get_the_author_meta("user_description", $authorID);
    
            $authorBio = "<p><b>Author:</b> $authorName</p>/n";
            $authorBio .= "<p><b>Bio:</b> $authorDesc</p>/n";
    
            echo $authorBio;
        }
    ?>
    

    Being that you are creating your own theme you can easily use the function get_the_content()… This will give you the content without echoing it… the downside of this is the filters that apply to the_content() are no longer applied. You can get the content with the filters from the get_the_content() function by using apply_filters(‘the_content’, $content) with $content being the return variable sent by get_the_content()

    A third option which was previously mentioned is to create your own filter… this would be best done in a plugin and would be able to be applied to any theme you may use in the future.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

building a site using PHP and MySQL that needs to store a lot of
I defined a class that I want to use for building a window. One
I am building a custom ViewGroup that arranges a bunch of children in particular
Building the same project (without any changes) produces binary different exe-files: some small regions
Building a website that has English & Japanese speaking users, with the Japanese users
Building my first SL MVVM application (Silverlight4 RC) and have some issues i don't
I'm building a report of case results with a parent-child grouping on the row
I have an event handler that needs to do something to one of its
I'm building a list of hashes that represent root to node paths in a
I have a Maven project that is a child project. It has many sibling

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.