Navigation überspringen

[Gelöst] Default Body Text

This support ticket is created vor 4 Jahre, 7 Monaten. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Dieses Thema enthält 1 Antwort, hat 2 Stimmen.

Zuletzt aktualisiert von Luo Yang vor 4 Jahre, 7 Monaten.

Assistiert von: Luo Yang.

Author
Artikel
#1827511

Is it possible to specify a default body Text for a Custom post type?

For example I have a CPT called Cards I want the body to always say "Click Here to Open [Post Title]" This is because my Theme pulls the post title and body copy through into my Search results page and displays in a grid but this particular CPT doesn't actually have any content so the search is just pulling through the title which breaks the layout.

Thanks!

#1828205

Hello,

There isn't such kind of feature within Toolset, you might consider custom codes, for example, use WP action hook save_post to trigger a PHP function:
https://developer.wordpress.org/reference/hooks/save_post/

In this PHP function, check the post body is empty, then setup the default text:
https://developer.wordpress.org/reference/functions/wp_update_post/