• 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

Customize Content Archive Content Limit in Archive Template?

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 › Customize Content Archive Content Limit in Archive Template?

This topic is: not resolved

Tagged: content archive limit, Custom Post Type

  • This topic has 8 replies, 3 voices, and was last updated 9 years, 4 months ago by Brad Dalton.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • September 3, 2013 at 7:18 pm #60544
    scott9s
    Member

    Does anyone know how to customize the content archive content limit different for each archive post type?

    For example, when I am on the "posts", I want the content archive limit to be 500 characters. However, when I am on the archive for the custom post type of "photos", I want the content archive limit to be 0 characters.

    In genesis theme settings, its an all or nothing. I don't see a way to customize it by post type.

    https://www.screenflex.com/photos/
    September 3, 2013 at 8:23 pm #60550
    Brad Dalton
    Participant

    What you can do is is conditionally control the limit in the excerpts.

    Please let me know if you need help customizing this code.


    Get Help – Book Consultation.

    September 3, 2013 at 8:48 pm #60554
    scott9s
    Member

    I tried the excerpt length, and that doesn't work when you are using the content archive length in the genesis settings.

    Thanks for the suggestion.

    September 3, 2013 at 9:43 pm #60564
    Brad Dalton
    Participant

    That's right. The Content Archives control the content length when using the content limit.

    Try using the excerpt rather than content limit in the Genesis Settings.

    I tested this and it works perfectly with the code above.

    I did write a full post about this recently that may help. http://wpsites.net/web-design/set-post-content-limits-for-home-blog-archive-pages/


    Get Help – Book Consultation.

    September 11, 2013 at 3:48 am #61859
    francky
    Member

    @braddalton
    I just checked the code, but how can I change the content limit to specify the number of letters and not words?
    I mean limiting to letters and not words;
    CHANGING: This is an example text and if you want ... [read more]
    TO: This is an example text and if you wa ... [read more]

    I shall appreciate your help Sir!

    September 11, 2013 at 6:09 am #61889
    Brad Dalton
    Participant

    Can't be done as far as i know. It uses the words not characters.


    Get Help – Book Consultation.

    September 11, 2013 at 6:23 am #61892
    Brad Dalton
    Participant

    Actually, it can be done as i just saw some code for it here http://wordpress.stackexchange.com/questions/69436/excerpt-in-characters


    Get Help – Book Consultation.

    September 11, 2013 at 8:31 am #61918
    francky
    Member

    Thank you @braddalton

    I tried the code below but it doesn't work. Sorry I'm not good a coding...

    function get_the_popular_excerpt(){
    $excerpt = get_the_content();
    $excerpt = preg_replace(" (\[.*?\])",'',$excerpt);
    $excerpt = strip_shortcodes($excerpt);
    $excerpt = strip_tags($excerpt);
    $excerpt = substr($excerpt, 0, 400);
    $excerpt = substr($excerpt, 0, strripos($excerpt, " "));
    $excerpt = trim(preg_replace( '/\s+/', ' ', $excerpt));
    $excerpt = $excerpt.'... <a href="'.$permalink.'">more</a>';
    return $excerpt;
    }
    September 11, 2013 at 10:53 am #61963
    Brad Dalton
    Participant

    Its not my code and comes from the WordPress.org Codex.

    You would need to add it to a custom function.


    Get Help – Book Consultation.

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

© 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