There might be other causes to the issue in question, but one issue I noticed in your code is that because you are looping through a custom WP_Query
instance, i.e. $loop
, then you need to use $loop->the_post()
instead of just the_post()
:
while ( $loop->have_posts() ) {
$loop->the_post();
the_title();
}
And you could see that I simply called the_title()
and not doing echo get_the_title()
, so you should also do the same.
Related Posts:
- Display articles with a different template in the home page | Solved |
- Query multiple custom post types in single loop
- Inject post (from specific category) between posts in Loop
- Alter query on edit.php
- Specific Loop For 2 Within Each
- spliting posts into two columns
- How to get to a specific position in wp_query?
- How can I add extra word in permalink when someone click download button?
- Increase offset while looping
- remove post that has no content
- How to add div blocks after certain set of post
- How to avoid duplicates when creating recent network posts
- How to overwrite orderby with add_query_var
- What file have I to create in my custom WordPress theme to show all the post belonging to a specific category?
- Issue with custom loop in Archive page
- Only show first image in foreach loop
- Do not duplicate posts with multiple categories in multiple loops
- Limit tags shown in post
- How to pick “full/thumbnail” images in the loop?
- Echo array value
- Wp Query : Order by distance lat,lon
- Advanced Query posts
- Build A Custom SQL Query for WordPress Search
- My Custom Post Type AJAX Query is Returning no posts – why?
- WordPress Custom Form – Getting Query Vars, Weird Glitch?
- Is there anyway I can call the year once?
- How do if all posts has this category ID then do this
- Let user select the number of posts shown per page jquery error
- Get current_post in reverse order with pagination
- Pagination in WP Queries
- Add div after every 4 posts then every 2 posts for a responsive loop
- Insert div after every three posts in home.php [duplicate]
- Get posts associated with media attachment
- Automatically create a loop for post ID
- Problems With Query and/or Template Part and/or PHP
- Excerpt all post content Content Same Size without word cutting off
- How to create a loop that will display one post and stop?
- How to use a conditional statement in a post loop but not count towards the “posts_per_page” if false
- Count the number of matching post names in foreach loop
- Issues applying JSON body filters in EU F&T Portal SEARCH API with WordPress integration
- How Display Posts on category
- Hide wordpress field if data is empty in post!
- How can I use wp_query to show all product data using just the products ID?
- Query all posts of a custom taxonomy term
- Retrieving Author ID in wp-admin area
- Get stock by custom meta field on all Woocommerce variable products
- Get first URL from post content
- Any possible way to make $wpdb->get_results() return anything else than array?
- How can I add multiple ‘tax_query’ arrays via a loop?
- ACF page while loop breaks footer while loop
- Getting a specific post values to another div or modal
- Custom filter in admin edit custom post type responding with invalid post type?
- Trying to add attribute to my posts’ featured image
- Accessing the database from a plugin outside of action hooks
- Echo a hierarchical list of post data from custom fields
- Displaying the last post on static homepage
- Using foreach loop breaks
- Cannot display or echo alt text on featured image
- Using Advanced Custom Fields to create a per page slider
- Split loop into two columns, how to favor one side over the other
- Can’t get wp_insert_post to work
- Why not yield/iterable in posts interface?
- WordPress Search Results for Multiple Post Types
- Create WP_Query to search for posts by their categories or their parent/child categories
- WP Query with custom Shortcode
- Best practice for migration friendly images in posts/pages?
- Storing Array from returned database query and using the array in a new query
- Changing layout with wp_customise
- Display post category in foreach loop with category link
- How to show part of the_content?
- Dynamic Stylesheet loads but doesn’t finish
- Filter Select results based on selection
- Using loop pagination on single.php
- Why WP_Query(‘showposts=5’) shows only 1 post?
- I would like to have different styles for my posts based on the content of each post
- mysql query from wordpress page using custom table
- Most liked page not displaying posts
- Loop with slider (slider not loading)
- How to hide all child pages with post_query?
- How to sort posts based on the value (number) of a post’s metadata?
- WordPress 3.2 query_posts and pagination, permalinks issue
- Show css depending on activity type in BuddyPress activity-loop [closed]
- only show container with next/prev links if they exist?
- Unreadable pagination
- 200 Rewrite blog post links
- What query string parameter is available for index.php, that works for both pages and blog articles?
- ACF: how do I get the fields and its values of a specific group?
- How to set a min number of words for a blog post
- Why my filterable portfolio page work not perfectly between slug button and slug output WORDRPESS?
- Loop through categories and display posts title under each dropdown
- Get post id in a function when edit/add a post
- how do I get a specific post from a post with a subcategory in WP
- Automatically create child pages and grandchild pages when saving a (parent) page
- wp_trim_words() does not work with my code Am I doing any mistake in my code?
- Set WP_query ‘order’ option by another tables value
- Second transition_post_status hook fired instead of the first
- Iterate through posts based on array of categories
- WordPress default Search function inconsistent in WooCommerce Product Titles
- get author_name from queried post
- Displaying Woocommerce Product Category in WordPress