Site logo

Archived topic

Change excerpt Length and source

14 replies · Started by Dave on January 3, 2021

Viewing posts 1–15 of 15

I would like to change where the excerpt is drawn from on my blog post page. Currently, I would have to enter an excerpt for each post separately. Is there a way to have it pull from the beginning of the post instead and then just continue into the post?

cheers,

Dave

Thanks Leo, but that is not the excerpt that I am referencing. It is the excerpt that has been created on the post in the Private Information section. It is the single..php.
I belive the code I am using is drawing specifically from the excerpt and I would like to draw from the actual post.

cheers,

Dave

So you are referring to the excerpt in the page hero?

Are you currently using this snippet here?
https://docs.generatepress.com/article/page-hero-examples/#example-4

If so edit the PHP snippet to this:

function db_page_hero_excerpt() {
    ob_start();
    global $post;
    ?>
    <div class="page-hero-excerpt">
        <?php echo the_excerpt(); ?>
    </div>
    <?php
    return ob_get_clean();
}
add_shortcode( 'page_hero_excerpt','db_page_hero_excerpt' );

Do you have any idea how I would implement them to come up with the desired effect?

Cheers,

Dave

That is the section but I think this is way above my limited abilities at the moment :)

I will look for another solution.

cheers,

Dave

If I understand this correctly I will have to add it in for each post as it will be different for each one. I have over 500 posts and don't want to do it for each one :)
Is there another solution?

cheers,

Dave

You will only have to add the custom field once in the page hero, but yes each custom field will need to be added within the posts itself.

There isn't another solution unfortunately.

Is it possible just to move the featured image to the right and above the sidebar?
That way the post can continue under the title?

cheers,

Dave

Can you open a new topic for the separate question?

Thanks!

I actually already did :)

Cheers,
Dave

Thanks!

We will get to it :)

This archived topic is closed to new replies.