• 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

Post teasers questions

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 › Post teasers questions

This topic is: not resolved

Tagged: post teaser format, post teaser length

  • This topic has 4 replies, 2 voices, and was last updated 9 years, 9 months ago by Elaine Griffin.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • July 1, 2013 at 2:41 am #48636
    Elaine Griffin
    Member

    Hello,
    I have a few questions about formatting post teasers.
    1. Is there a way to set the teaser to show the first 2 paragraphs?

    2. Is there a way to set the teaser to show the meta description?

    3. Is there a way to keep it from stripping the formatting?

    I don't really have a link to a site, because I'm working on multiple sites who's owners are wondering about these things.

    Thanks for any help - it's always appreciated!
    Elaine

    July 1, 2013 at 5:47 am #48649
    Brad Dalton
    Participant

    1. You would need a custom loop with variables to display the first 2 paragraphs. Or you could use the Genesis > Content Archives > Content Limit

    2. You can use the native Excerpts function included in all edit post screens. You can add the meta description manually as an excerpt.

    If adding the excerpt manually, you may use (some) HTML formatting and the tags will not be stripped


    Tutorials for StudioPress Themes.

    July 1, 2013 at 8:02 am #48665
    Elaine Griffin
    Member

    Thank you for this!
    Numbers 2 and 3 I get, but could you go into a little more detail about 1? I am only very slowly understanding any PHP.
    Thank you so much!

    July 1, 2013 at 8:51 am #48673
    Brad Dalton
    Participant

    You would need something like this

    Or you could use the Genesis > Content Archives > Content Limit but it cannot be set to the first 2 paragraphs, only a character limit.

    I have written some code which uses the amount of paragraphs in a custom function but would need to modify it to work the way you want it to.

    Here's an example where you can take the variables and use them to modify the post excerpts to display 2 paragraphs.

    Would require a fair amount of modification and testing.

    https://gist.github.com/5150240


    Tutorials for StudioPress Themes.

    July 1, 2013 at 11:13 am #48703
    Elaine Griffin
    Member

    Okay, I did see those examples in my search.
    This is what I was thinking:
    <?php
    //* Do NOT include the opening php tag

    //* Modify the length of post excerpts
    add_filter( 'excerpt_length', 'custom_excerpt_length' );
    function custom_excerpt_length( $length ) {
    return 50; // pull first 50 words
    }

    What I was confused about was whether or not I could write:
    retrun 2; // pull first 2 paragraphs

    Thank you so much!

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 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

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