Display posts from another page on home page in wp-editor

I created shortcode in functions.php: add_shortcode(‘projects’, ‘projects_shortcode’); function projects_shortcode($atts){ extract(shortcode_atts(array( ‘post_type’ => ‘project’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => 3, //’caller_get_posts’ => 1 ), $atts)); $args = array( ‘post_type’ => $post_type, ‘post_status’ => $post_status, ‘posts_per_page’ => $posts_per_page ); global $post; $posts = new WP_Query($args); $out=””; if ($posts->have_posts()) while ($posts->have_posts()): $posts->the_post(); $overview_image = get_field(‘small_overview_image’); $out .= ‘<div … Read more

Shortcode to include PHP file, pass various parameters to include?

Thanks for your comments and guidance. I implemented solutions which didn’t reinvent the wheel. The complication was finding a way to remove the [insert_php][/insert_php] wrapped code from pages and posts and still preserve the content and user experience. Custom Template Pages Pages and Posts which were almost entirely PHP were made into custom template files. … Read more

Help with Shortcode Functionality

Shortcodes should return a string, not echo data… so you have one of two options here: Change all echo statements and all functions that ‘echo’ content to use with return (concatenate all on a string, then return it) Use output buffering For output buffering, your code would end up like: function upcoming_events_shortcode() { $args = … Read more