How do I create a template page to show 3 blog posts?

before start your posts loop in a custom page template you need to get posts from database by using wp_query() or get_posts() do some thing like this. $args = array( ‘posts_per_page’ => 3 ); $my_query = new WP_Query($args); // now start your loop if ( $my_query->have_posts() ) { while ( $my_query->have_posts() ) { $my_query->the_post(); // … Read more

Display DISQUS on homepage

Hook it in from your child themes functions file or add the template tag to a front-page.php file Untested add_action(‘loop_end’,’disqus_front_page_after_loop’); function disqus_front_page_after_loop() { if (is_front_page() && function_exists( ‘comments_template’ ) ) { comments_template(); } } Change the loop_end hook to another WordPress or theme specific hook. If using the template tag, you might want to try … Read more

2 Categories using same template but one has a problem? [closed]

This question as mentioned in the comments is not related to wordpress by any means. But anywho remove the float on your #portfolio-item and add some flex like its 2015. #contentportfolio { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-flex-wrap: wrap; -ms-flex-wrap: wrap; flex-wrap: wrap; } People still play sims?

WordPress “Posts Page” isn’t showing template dropdown

Ben, Welcome to StackExchange! Page Templates are only able to be defined in the Page post type (“Pages” in the WP-admin). https://developer.wordpress.org/themes/template-files-section/page-template-files/#uses-for-page-templates You can edit your theme (or create a child theme) to define how your post pages are displayed. Depending on your needs you could define an archive.php, category.php or index.php in your theme … Read more

CPT Template Option to Top

You could hook into theme_{$post_type}_templates and add an identical “default” option at the end: add_action(‘theme_page_templates’, ‘wpse_296283_theme_page_templates’); function wpse_296283_theme_page_templates($post_templates){ $post_templates[‘default’] = “Default Template”; return $post_templates; } Then you’d hide the first one with CSS: add_action(‘admin_head’ ‘wpse_296283_admin_head’); function wpse_296283_admin_head(){ ?> <style>#page_template option:first-child {display: none;}</style> <?php }

Enclose article’s body with default shortcode

Thanks to @kero I have implemented this code: <?php echo do_shortcode(‘[responsivevoice voice=”Italian Female” buttontext=”Ascolta”]’.'<br>’.$bodyContent.'[/responsivevoice]’); ?> The $bodyContent variable contains the HTML value of the article’s body, obtained using this function: http://www.web-templates.nu/2008/08/31/get_the_content-with-formatting/index.html <?php $bodyContent = get_the_content_with_formatting(); ?>