• 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

Get parent page title?

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 › Get parent page title?

This topic is: not resolved
  • This topic has 3 replies, 2 voices, and was last updated 12 years, 9 months ago by Posh John.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • November 2, 2013 at 11:04 am #70526
    Posh John
    Participant

    I've created a page template and need to add the parent page's title.

    I tried adding this:

    //* Add Title Bar
    add_action( 'genesis_before_entry_content', 'cw_title' );
    function cw_title() {
    	$parent_title = get_the_title( $post->post_parent );
    	echo '<h1>Directory Of Locations In ' .$parent_title. '</h1>';
    		
    }
    

    It just echoes the current page title, not the parent page title - any ideas why?

    (also i'd ideally like to make the variable $parent_title available to other functions...)

    Thanks


    Thus the heavens and the earth were completed in all their vast array. Genesis 2

    http://development site
    November 2, 2013 at 4:08 pm #70568
    nutsandbolts
    Member

    Just to verify, you're using one of the newer, HTML5-compatible child themes, right? If not, the genesis_before_entry_content hook won't work. I'm sure the answer isn't that simple, but I like to start with the easiest possibility first. 🙂


    Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
    I provide development and training services for designers • Find me on Twitter and Google+

    November 2, 2013 at 4:28 pm #70576
    Posh John
    Participant

    Hi,
    Yes i am using HTML5. The problem is not with the hook, it's just the fact that it's picking up the page title and not the parent page title.
    I checked the codex and my code should work....?


    Thus the heavens and the earth were completed in all their vast array. Genesis 2

    November 3, 2013 at 10:48 am #70685
    Posh John
    Participant

    I figured it out so i thought i'd add it here just in case anyone else needs to know.

    I just needed to add global $post;


    Thus the heavens and the earth were completed in all their vast array. Genesis 2

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

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

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 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