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
- Exclude posts with empty post_content in wp_query
- Loop through all product posts?
- Improving WP_Query for performance when random posts are ordered
- Accessing post->ID outside of the loop for listing child pages
- 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
- How To Get Posts With A Specific Word
- is there a way to show the the post title after the image?
- Display all posts that were published before full post on single.php
- Two loops, one AJAX loop, exclude posts in first loop from second loop, loops are in different files
- WP Query – Posts Per Page not working in combination with category__in
- 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
- Nested WP_Query breaking loop
- WordPress query_posts by tag doesn’t work anymore(?)
- How to get post ID in a Page?
- 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
- Query for first 3 posts to change the look and feel
- 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
- Getting blog pagination to work on page set as front page
- How to check in functions.php if there is data in a WP_Query?
- Shortcode with ‘year’ parameter
- On what hook can I get the queried object’s final state?
- 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
- Do not duplicate posts with multiple categories in multiple loops
- How to display post list in a table layout (multiple queries in single loop)
- Not all posts showing in query
- 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
- WordPress query portfolio posts
- Display specific posts on home page
- WP_Query of Category Not Showing First Post
- Limiting the amount of posts retrieved by the loop
- 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?
- show loop id post , only first id can read
- Show 5 posts and than 3 posts offset with pagination
- Double loop output
- wp_query args with relation
- Loop through all posts showing duplicates
- Manipulate query to show specific post
- Wp_query loop is not working as it should
- Use special template for the first post in the loop
- Create a hierarchical loop at predefined markup requirements
- WordPress loop uses unmodified posts array, why?
- Sort / Filter Queries
- Modify WordPress loop after it has been run
- show latest authors blog post
- Advanced Post Display/Pagination/Ordering
- Why I have this strange behavior when I try to exlude the featured post from posts visualization?
- 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?
- Remove duplicated posts in the loop if post has more than one category
- How to limit the number of results for all query_posts on mysite
- Make assigning post to a specific category equivalent to assigning it to all categories