• 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

Add excerpt after page / post entry-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 › Design Tips and Tricks › Add excerpt after page / post entry-title

This topic is: not resolved
  • This topic has 6 replies, 2 voices, and was last updated 13 years, 3 months ago by Brad Dalton.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • May 16, 2013 at 9:05 pm #41302
    csbeck
    Member

    I'm using Agency and I would like to show some text below the page's/post's title - only on their individual page/post.

    I was thinking I could put the excerpt there or some custom field text by creating a new single-page and single-post template or by using a hook. The only other way I can think of for doing what I want to do, is to create a styled paragraph. Which I can do. But I'm wondering if doing it with the excerpt and hook or template might be better. Has anyone done something like this or at least can someone make some suggestion?

    Development site: http://acquireb2bdev.com/

    Thanks much! Chris

    http://acquireb2bdev.com/
    May 16, 2013 at 9:20 pm #41304
    Brad Dalton
    Participant

    Try this:

    Code not displaying? Grab it on Github.


    Tutorials for StudioPress Themes.

    May 17, 2013 at 5:51 am #41335
    csbeck
    Member

    This is great Brad. I'll give it a try.

    With this hook in there, how would I dynamically pull the excerpt or custom field content into this section?

    Would I?:

    • Create a custom field on the page (I could call the custom field "thispage_excerpt")
    • Add content (value)
    • Then in your code put something like:
      • echo '<div class="single-title"><?php the_meta(); ?></div>';
    
    
    		
    	
    May 17, 2013 at 2:31 pm #41429
    csbeck
    Member

    Your code needed another set of curly brackets to encase the statement within the if statement. Then the text showed up just like I wanted!

    But now I want to add some dynamic text there so different pages could show different text and I'd like to modify that from the page.

    OK, so here's the code that I put in my functions.php:

    function after_title_text() {
    if(is_page() ) {
    echo '<div class="thispage_excerpt"><?php the_meta(); ?></div>';
    }};
    add_action('genesis_after_post_title', 'after_title_text');

    I've also added a custom field on my test page: http://acquireb2bdev.com/products

    Key: Page ExcerptValue: This is my excerpt.

    When I test the page out, the div exists on the page but the content doesn't. I'm afraid that I'm doing custom fields incorrectly. Can regular pages not have custom fields? Can you give any further advice?

    Thanks, Chris

    May 17, 2013 at 3:01 pm #41431
    Brad Dalton
    Participant

    Hi @csbeck

    I tested my code before I embedded it here and it works.

    I also tested it again now and it stills works.

    I am fully aware it doesn't include the braces which I normally add to PHP code when hooking in widgets, but it doesn't need the braces when echoing in basic text.

    1. Firstly, when pasting code in this forum, please use the PHP shortcodes. You can learn more in FAQ No.5

    2. When copying PHP code from a embedded snippet, use the view raw link and paste it at the end of your child themes functions.php file using a text editor like Notepad++.

    If you use the WordPress theme editor, the apostrophes can change and cause errors.

    I'd suggest you post your second question as a new thread.

    Personally, I have never used custom fields and prefer pure PHP code as its cleaner and easier to manage. Why complicate things which result in less efficiency?

    I'll try to find you a solution using PHP without the custom fields.

    Thank you.


    Tutorials for StudioPress Themes.

    May 17, 2013 at 4:02 pm #41439
    csbeck
    Member

    Hi Brad,

    Thanks so much for both your FAQ suggestion and looking into a solution. I will do better at posting code now.

    As for your code, your code does work, I was incorrect and I apologize. But it didn't work on the PAGE where I was looking because a single PAGE is not identified as "single". So your code didn't affect my test PAGE. Now I went to a post and there is your text. So thanks for getting that to me. I hope you don't take offense at my responses due to my ignorance and less experience of PHP - which I'm attempting to improve upon - I'm more of a designer.

    If anyone cares, I've modified the code to be this so that it will appear on both PAGES and POSTS:

    function after_title_text() {
    if(is_page() || is_single() )
        echo '<div class="single-title">Add content after your titles but before your content here</div>';
    };
    add_action('genesis_after_post_title', 'after_title_text');

    So thanks again and your searching for an alternative is very much appreciated.

    Though I don't understand why I would need to create a separate thread; I still feel the solution to this (be it PHP, shortcodes, or custom fields) would be associated to my original question, I will create a separate thread.

    Thanks! Chris

    May 17, 2013 at 6:43 pm #41452
    Brad Dalton
    Participant

    Thanks for the code Chris and explanation about the different conditional tags which effect pages and posts.


    Tutorials for StudioPress Themes.

  • Author
    Posts
Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘Design Tips and Tricks’ 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