• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Place main title in a title bar, not children

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Place main title in a title bar, not children

This topic is: resolved

Tagged: children, page-title, parent, post title

  • This topic has 4 replies, 2 voices, and was last updated 10 years ago by D. van de Kamp.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • June 4, 2015 at 4:13 am #154825
    D. van de Kamp
    Participant

    Dear people,

    How do I go about getting the title of the parent page in a title bar? For example, I have a news page. Above that page is a full width black banner with the title 'news'. What I want is the parent page's title 'news' to be in the title bar also when I go to a
    a post. But I also still want to see the title of the post above the post.

    remove_action( 'genesis_entry_header', 'genesis_do_post_title' ); -> removes the titles all together. But also removes all the post titles.

    add_action( 'genesis_after_header', 'gs_create_entry_title_banner' );
    function gs_create_entry_title_banner()
    {
    $parent_title = get_the_title($post->post_parent);
    echo '<div class="title-bar">';
    echo '<div class="wrap title-bar-inner">';
    echo $parent_title;
    echo '</div></div>';
    }

    works in the sense that it now places the title in a separate area right after the header, but for some reason it now seems to grab the first post title and uses that as the page title. It doesn't grab the parent. And I still have the problem that the post titles were removed alltogether.

    Last but not least, I don't want this title bar on the home page.

    Can anyone help me?

    http://localhost
    June 4, 2015 at 4:25 am #154827
    SavvyJackie
    Member

    Just a shot in the dark, but would this help?

    http://wpdev.co/code/parent-page-title/


    Web Designer and Developer at Savvy Jackie Designs | Lucky with plants | @SavvyJackie

    Got your question answered here? Please pay it forward by helping someone else. I’m sure there is at least one question you can answer. 🙂

    June 4, 2015 at 9:44 am #154862
    D. van de Kamp
    Participant

    Thanks, but for some reason it keeps using the last added post as the page title for the archive page and it keeps adding the post title in the title bar. So that didn't work for me unfortunately

    June 11, 2015 at 4:02 am #155824
    D. van de Kamp
    Participant

    Anyone else able to help? So what I want is for the custom post types "news, projects and student assignments" that the page title just below the header always shows "news, projects or student assignments" even when I go to a deeper level.
    But for the deeper level I also still want the post title just above the content.

    So e.g. Header with navigation, then bar with title 'News' then content area with title of the news item, then content of news item.

    June 12, 2015 at 2:56 am #155957
    D. van de Kamp
    Participant

    So for anyone looking for a sollution. I finally found a work around to accomplish what I wanted. Here's the code:

    /**
    * Move the title just after the header:
    */
    add_action( 'genesis_after_header', 'dvdk_create_entry_title_banner' );
    function dvdk_create_entry_title_banner() {

    if ( is_post_type_archive( 'news' ) || is_singular( 'news' ) )

    $parent_title='News';

    elseif ( is_post_type_archive( 'projects' ) || is_singular( 'projects' ) )

    $parent_title='Projects';

    elseif ( is_post_type_archive( 'student-assignments' ) || is_singular( 'student-assignments' ))

    $parent_title='Student assignments';

    else

    $parent_title = get_the_title( $post->post_parent );

    echo '<div class="title-bar">';
    echo '<div class="wrap title-bar-inner">';
    echo $parent_title ;
    echo '</div></div>';
    }

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Place main title in a title bar, not children’ is closed to new replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble