How to display on the blog page the posts corresponding to the selected language, using Polylang

you can add the lang parameter to your loop arguments like so $loop = new WP_Query( array ( ‘post_type’ => ‘post’, ‘lang’ => pll_current_language(‘slug’), //returns ‘en’ for example ‘posts_per_page’ => 10, ‘post_status’ => ‘publish’, ) ); However this is not the better practice because by doing that way we override the main query which is … Read more

How to display only the excerpt in the blog/posts page with Gutenberg?

You should use a custom page for this. For reference, we can modify the default (twentynineteen) post content block. Depending on your theme, you may need to modify single.php, or a content block included from there. In the twentynineteen theme, we can see this on line 24: get_template_part( ‘template-parts/content/content’, ‘single’ ); Following that, we can … Read more

How can I show the actual content of Posts page because the_content() is showing all blog content?

You can use: get_queried_object_id() to get the ID of the static posts Page. Alternatively, you may also use get_option( ‘page_for_posts’ ). $post_id = get_queried_object_id(); //$post_id = get_option( ‘page_for_posts’ ); // you should use the above on the blog page $content = get_the_content( null, false, $post_id ); get_queried_object() to get the full data of the static … Read more

How to display blog posts on a dedicated page?

Setting your permalinks as /blog/%postname%/ will solve your structure problem. In your theme, drop in a home.php file which redirects the user to /blog/ and you can set the blog to appear on a page with slug blog as the blog in your Settings > Reading Regarding the menu, you would have to take a … Read more

is_page(id) not working for blog page

If the page you’re trying to check is set as Page for posts, then is_page conditional won’t be true. In such case you should check if is_home. Why? All these conditional tags are based on global wp_query. For page that is set as page for posts (home of your blog), the global query doesn’t contain … Read more

Why aren’t my posts showing?

This doesn’t work the way you think it does because get_pages doesn’t do what you think it does. First, understand that all pages, all content, in WordPress is really a “post”. A “Page” is just a special type of post. Now, in a normal environment, you wouldn’t call “get_” anything. This is why you’re confused, … Read more