<?php
if (have_posts()) : while (have_posts()) : the_post(); endwhile;
else:
_e('No blog found.', 'polymer');
endif;
?>
if(have_post)
condition is to check if the page contain post, while(have_posts)
condition if there is more than one post display in loop, the_post()
is used to display the post if(have_post)
condition fails it will go to else
loop. Tell for any further doubts…..
Related Posts:
- Should we trust the post globals?
- WordPress Number of Posts Not Changing With posts_per_page
- Looping through posts per category gives same posts for each category
- How to setup a query to output posts by groups of five?
- Exclude current custom post on single post
- First x post with another template then the others
- WordPress loop not working on static front page
- Get current taxonomy and display query accordingly
- Need to display a Jan 1st post as the site’s front page on Jan 1st, and Jan 2nd post as front page on Jan 2nd etc
- Display the latest post from some selected authors
- Advanced Post Display/Pagination/Ordering
- Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?
- Grab next post title in archive page
- How to get posts published between a date and today?
- Get first post from wp_query
- How to know if get_posts() failed?
- Why do I need to use The Loop on pages (inside page.php etc)?
- Duplicate posts
- Count singular post views automatically
- Display All Sticky Post Before Regular Post
- How to have different content in the loop and single
- Repost post on specific date every year
- Display Latest Post from all Categories
- custom wordpress post loop – hide iframe content
- Divide Loop Into Days & Categories
- Check if post exists
- Contact form 7 post loop [closed]
- How to display different number of posts
- WP Query – duplicated posts once including tags in search results
- wp_tag_cloud() and the_taxonomies() work but not the_tag()
- Show all posts in sidebar in single.php
- Split WordPress Latest Posts in Multiple Columns and Rows with one single loop [closed]
- Avoid duplicate post from same Taxonomy
- Alternate row and columns every X posts
- Best way to assign post position in a news site homepage? (no categories, no sticky posts)
- How do I restart my loop with get_next_post()?
- Posts will not display on page-mypage.php
- Exclude the first ‘n’ number of posts of a tag from home page?
- wp_query random post
- How many posts does the loop return?
- Display Posts on Custom Page
- Possible to alternate between two loops
- Multiple Loops Breaking Pages
- Inner join overrides Advanced Custom Fields plugin’s get_field [closed]
- Counter is skipping post when I still want it visible [closed]
- The_excerpt() doesn’t parse – how to change that?
- Trying to edit archive.php to only show post extract, with featured image
- How to only publish posts with image in it
- Extracting relevant tags associated with that particular single post only
- WordPress query undefined offset in loop
- Exclude some posts from displaying in wp_query based on some condition
- Show posts by quarter
- Optimizing the blog loop
- Accessing Post ID Within Loop
- If custom field is empty, use one from a previous post
- Cant’ Grab WordPress Built-in Posts Through Loop
- Pagination for normal (standard) posts on a page with a custom loop?
- I can’t find the relevant part of the loop in my theme file. How do I find the full content with “More…”
- Adjust the order for returned posts
- Trim posts from WP-Query?
- How to show full post on home page
- Trying to exclude custom posts based on date, while sorting by custom field
- how to add tags to post in the Loop?
- Merge get_comments & get_posts into a single query
- Current post categories and subcatecories outside of the loop
- Numbered Pagination Showing The Same Posts After Altering WP_Query
- “read more” redirects to the wrong page
- Count singular post views automatically
- I have two post types in the same query, how can I use CSS to select only one post type?
- Loop and output 4 rows of posts on home page
- Bulk Post update_post_meta
- How to show category image if no featured image is set?
- Get post id outside loop : Notice: Trying to get property of non-object
- Retrieve posts inside foundation tabs and tab-content split by 3 per row
- Loop through all posts showing duplicates
- Post being duplicated with foreach loop
- Numbering author posts in posts query
- Custom post type – Loop out in random order but same 15 to appear first… still random
- WordPress Request Post All Post ID in a Loop? [closed]
- List Authors For Current Category
- Sort / Filter Queries
- How to show the posts list into a static page? Problems to use the loop into a static page
- How to use extract shortcode in loop?
- Adding a category at even positions on main loop with modified pagination
- Displaying Results From Custom Taxonomy Query
- Get first comment link on the post itself
- wordpress taxonomy results
- Make division in post_query?
- Displaying posts on Homepage
- Where are my posts linked to? I keep getting a Not Found Error, and I have no single.php page
- The loop: more posts than I want to fit on one page
- WordPress posts loop pagination – first page return 125 posts instead of 10 and the rest return 10
- The post order is different for logged-in and non-logged-in users? [closed]
- Display one post randomly from category on home page
- Index.php is ordering posts strangely
- How do I show the post title if an advanced custom field hasn’t been used?
- Custom post order returning posts from other categories
- CSS code for “inserting a custom post divider” after each post
- Display posts with id equal to relationship value
- Sort Posts Alphabetically Based on Specific Category (Divi)