the_content_limit
does not exist in WordPress. You probably want something like the_excerpt
.
What’s likely happening is your loop is working fine, but the call to an undefined function causes the program to error out, making it appear the the loop is not working. Look at the rendered HTML: you’ll probably see a single, opening <li>
tag, the link and an opening paragraph tag.
showposts
is also deprecated. Take a look in the codex: dropped in 2.1
Try this:
<?php
$query = new WP_Query(array(
'posts_per_page' => 5,
));
while ($query->have_posts()): $query->the_post(); ?>
<li>
<a href="https://wordpress.stackexchange.com/questions/85256/<?php the_permalink(); ?>"><?php the_title(); ?></a>
<p><?php the_excerpt(); ?></p>
</li>
<?php endwhile;
Related Posts:
- How to exclude latest x posts from a paginated query?
- Search widget breaks when using multiple loops?
- How would I get 1 latest post from a query for 5 posts?
- Blog post per page setting conflicting with custom WP_Query?
- How to exclude latest x posts from a paginated query?
- List authors with the last post title and order by last post date
- How to get posts published on the latest date?
- WP_Query: Show 10 posts in date order, first three random
- Display 3 posts with different HTML markup using a loop
- Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?
- Adding a category at even positions on main loop with modified pagination
- Should we trust the post globals?
- How to get posts published between a date and today?
- Get first post from wp_query
- Inject post (from specific category) between posts in Loop
- WP_Query: Why is sticky post not first item in loop?
- Display all posts from specific categories on a page
- How do I reorder (pop and push) items from WP_Query?
- Display content from a specific category
- Reverse chronology of post listing
- Query posts distinct authors
- How to get previous 10 days post from a specific date – WP Query
- WordPress Number of Posts Not Changing With posts_per_page
- This AJAX Code Doesn’t Work – Looking for elegant solution
- Specific loop in Shortcode
- Strange switch_to_blog() issue
- How to Display Post View Count
- Function to show random posts from a category
- Hiding posts in a list from specified categories
- Converting multiple loops into one single loop with pagination
- Group posts by year in loop
- Exclude posts with empty post_content in wp_query
- Loop through all product posts?
- WP Query – duplicated posts once including tags in search results
- Reset Popular post query?
- Display post from current category and same tag?
- Inserting custom data to the_post() during loop
- Display post category in foreach loop with category link
- is there a way to show the the post title after the image?
- Pausing and Resuming WP_Query results
- Random ajax load only works with posts_per_page set to -1
- How to : pagination in 3 different custom loops on the same page
- posts_per_page option limits the number of Gallery items
- wp_query random post
- wp_posts table: safely remove unused columns to save database storage
- Query Posts by Custom Field
- How to order posts in an arbitrary order?
- Display Posts on Custom Page
- Possible to alternate between two loops
- Wrong post title displayed from loop
- Get the amount of posts on a current page
- why the same code got different results when using query_posts in functions.php and index.php
- How can I remove the first two words and shorten get_the_title()
- How to only publish posts with image in it
- Page and post loop same template
- How to check in functions.php if there is data in a WP_Query?
- Display current post position in Elementor Posts widget
- wp_query with ajax
- How to give classname to post if post has no content?
- WordPress Loop: How to display recent posts in multiple divs
- Random posts that always include a particular post?
- WordPress post filter menu
- how to handle the loop using filling bootstrap grid structure?
- Query function not executed between element [closed]
- Custom WP_Query not working correctly
- Echo the number of posts being displayed
- Display specific posts on home page
- WP_Query of Category Not Showing First Post
- Change content off every sixth element
- Defining ‘last’ class on foreach blog posts
- Wp Query : Order by distance lat,lon
- While loop in functions.php outputting the_title() of each post on frontpage
- Show posts from two specific category in WP_Query
- WordPress sorting posts by date and title using a dropdown
- How to create loop of posts except post ID defined via ACF field
- Displaying all posts from other sites on the network on one site
- Is there anyway I can call the year once?
- Multisite how to display merged posts from two sites and sort by latest date?
- Display specific posts based on an ID of another post
- Numbered Pagination Showing The Same Posts After Altering WP_Query
- How to show post views shortcode data for each post on Posts List Page?
- Double loop output
- wp_query args with relation
- Loop through all posts showing duplicates
- Manipulate query to show specific post
- Use special template for the first post in the loop
- Sort / Filter Queries
- show latest authors blog post
- Advanced Post Display/Pagination/Ordering
- How to show the posts list into a static page? Problems to use the loop into a static page
- Automatically create a loop for post ID
- How do I control the fallback query after the original query returned cero posts?
- Make assigning post to a specific category equivalent to assigning it to all categories
- How to inject a post within a loop
- wp_query select if have comments
- How do I show the post title if an advanced custom field hasn’t been used?
- How to modify this function to exclude also the post belonging to a specific category?
- posts_per_page – Repeats only first posts ‘post__in’ array
- query_posts different amount of posts per page [duplicate]
- How to use a conditional statement in a post loop but not count towards the “posts_per_page” if false