ASKER
$specials_post = get_post(100); //ASSUMES THE POST ID IS 100
$specials_content = apply_filters('the_content', $specials->post_content);
ASKER
ASKER
// [specials]
function specials_func( $atts ) {
$recent_posts = wp_get_recent_posts( array( 'numberposts' => '1' ) );
$thePostID = $recent_posts[0]['ID'];
$specials_post = get_post($thePostID); //ASSUMES THE POST ID IS 1
$specials_content = apply_filters('the_content', $specials_post->post_content);
//print_r($specials_post);
return $specials_content;
}
add_shortcode( 'specials', 'specials_func' );
But I have noticed it doesn't get the featured image. No problem: I've dropped the feature image and put the image directly in the post content, centering it. And now in the post the image is centered but in the home page it is aligned to the left. But adding a line of custom CSS solved the issue.ASKER
ASKER
ASKER
If I only had local clients... I'd be living... under a bridge... in a box... with a cat on a leash... with an unhappy wife... :-)Exactly like me, David... LOL
WordPress is a free and open-source content management system (CMS) based on PHP and MySQL for creating websites and blogs. Features include a plugin architecture, a template system and strong management, customization and search systems; through its dynamic presentation of content, webmasters have the flexibility to create websites easily.
TRUSTED BY
Here's how I fix this.
1) Use https://wordpress.org/themes/generatepress for your theme.
Reason: Many themes are broken... in so many different ways... so many variations... the conflict with plugins + WP Core + Gutenberg...
Rather than deal with these complexities, only use a light weight theme.
2) Use https://wordpress.org/plugins/classic-editor to disable the entire Gutenberg editing facility.
Reason: Same as #1. The complexities... at least for now... of Gutenberg + many themes + page builders leading to all manner of content rendering problems is large.
Rather than deal with trying to understand + debug + push back on developers to fix their code, just disable Gutenberg.
Especially for a simple site.
3) Elementor... sigh... Many page builders - Elementor + Beaver especially - use a similar implementation approach... which increases round trip POST data payloads as site complexity increases.
This eventually causes Apache memory overruns + seriously odd errors.
I've opened tickets for years against both page builder to fix this problem.
There are 2x solutions....
a) If you hit this problem, usually using an incognito window fixes the problem.
b) Or better, rather than using a Page Builder, use a show posts plugin.
https://wordpress.org/plugins/search/show+posts lists 100s of these plugins.
https://github.com/search?q=wordpress+show+posts+plugins lists 200+ more of these plugins.