Query wordpress posts on static page

By static page do you mean a WP page or do you mean a HTML page within the site? If it’s the first you need a page template, if it’s the latter then you need to include wp-blog-header.php into the file with php.

Full width images within post content

I believe you’ll want to set the image as a background image on the div (with inline CSS). In your template’s PHP you can use the following to get the URL to the full-sized featured image (within the Loop, of course): $image_url = wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) ); Then to assign this image as the … Read more

How to list all the posts in a personalized page? WordPress

There is a pretty simple way to query outside the loop using get_posts. Setting post_status => ‘any’ could net you all. The code below queries posts, pages and attachments. The loops through and outputs them all to an unordered list. $pages = get_posts( array( ‘post_type’ => ‘page’, ‘post_status’ => ‘any’, ‘numberposts’ => -1, )); $posts … Read more

foreach all the post

Your code has many errors:- $thumbs isn’t used anywhere. $img_url = $thumb[‘url’]; undefined variable if(is_array($thumb) && $img_url) always false because of second point. $search_data = []; should be outside of loop. Check the correct part of code $search_data = []; if($query->have_posts()): while($query->have_posts()): $query->the_post(); $img_url = get_the_post_thumbnail_url(); if(!empty($img_url)){ $search_data[] = array( ‘name’ => get_the_title(), ‘thumb’ => … Read more

How to find the page of specific post?

This question isn’t really great, as it’s well documented in many places, but the answer is: View the page source, and look in the “open” body tag. It should show something like: <body class=”single single-post postid-29654 … > This example the page id/post id is 29654

excerpt in template for specific page

The following code will query the “blog” category for the latest three published posts and loop through these results to display the excerpt from each. $args = array( ‘category_name’ => ‘blog’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => 3, ); $blog_posts = new WP_Query( $args ); if ( $blog_posts->have_posts() ): while ( $blog_posts->have_posts() ): $blog_posts->the_post(); // Do … Read more