Roemer
Roemer

Reputation: 2231

Show full post (not excerpt) for defined posts in wordpress

I'd like to have the possibility to define some posts in wordpress where the full post is shown and not an excerpt.

There are various solutions like:

The first one is easy but ugly, 2nd one should be doable with some googling but the 3rd one seems to be the most appealing to me but I have no idea how to achieve this.

Since usually in the template all i have is somewhere the_excerpt method from wordpress. I therefore should somehow inject some code there and check if the checkbox for the current post is set and then just use the_content instead. Is this possible at all or do I need to modify the theme anyway?

Thanks for your inputs.

Upvotes: 0

Views: 3125

Answers (1)

Stickers
Stickers

Reputation: 78676

I would use custom fields, it's more flexible, so you don't need to hard code the page ids.

<?php
$show_full_content = get_post_meta($post->ID, 'show_full_content', true);

if ($show_full_content == 'yes') {
    the_content();
} else {
    the_excerpt();
}
?>

You might be interested in ACF, it can make it more user friendly.

Upvotes: 1

Related Questions