2022 Developer Survey is open! Take survey.

Questions tagged [recent-posts]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
9 views

How do I add a small excerpt of a blog post on my Front Page Recent Posts widget?

Since my homepage is a static page, WordPress shows a Recent Posts tab with the HTML ID "front-page-recent-posts". This seems to be a unique widget, and I cannot find a way to edit its ...
user avatar
  • 1
0 votes
0 answers
11 views

Import Recent Posts Only and Ignore old ones if exist

I'm using MailChimp Campaigns Plugin where it imports all Mailchimp campaigns as a custom post type on the website. The app works perfectly however I'm modifying the process to import recent posts ...
user avatar
0 votes
0 answers
27 views

add title to widgets of wordpress

hello so i want to add on wordpress widgets title= before the href link to widget_recent_entries and widget_pages the title= so how can i do that ? it have an widget-title but not the title= to alla ...
user avatar
0 votes
0 answers
13 views

Cannot manage to display my CPT in Recent Posts widget

I tried a few solutions from the web, but none of them seem to work. // #1 add_filter( 'widget_posts_args', 'th_widget_recent_post_cpt' ); function th_widget_recent_post_cpt($args, $instance) { $...
user avatar
  • 101
0 votes
1 answer
70 views

How to obtain the recent posts without their content in an efficient way?

It would be great to make a single DB request but I don't know how to do that either. I have this code and it works but I want to change it to be more efficient: $cs = get_categories(array( '...
user avatar
0 votes
1 answer
25 views

How do I get the content excerpt of the recent post?

Hi I am needing some help trying to add the recent post excerpt to the bottom left div of my webpage. below is the piece of code that I'm having problems with in-between the p tags. I can display the ...
user avatar
  • 3
0 votes
0 answers
16 views

Users Query Permalink to Post URL

Using Elementor. I have a question, displaying users by roles (subscriber) on page with different user meta fields like image, username and button. Subscribers can add 1 property listing. Now I want ...
user avatar
1 vote
0 answers
25 views

How do I add recent posts to the menu?

How to add recents posts to the menu? Entries with pictures. "Menu-item-object-custom" items in a div container? What I have now is: header.php wp_nav_menu( array( '...
user avatar
0 votes
0 answers
101 views

Editing HTML structure of Gutenberg layout recent post?

I used gutenberg layout method with wordpress editor to call recent posts. Wordpress automatically generated this HTML structure. <ul class="wp-block-latest-posts__list has-dates wp-block-...
user avatar
0 votes
1 answer
45 views

Recent posts on homepage: different thumbnail based on logged in status and post category

This works well on archive.php, but not working on the homepage. For some reason, the first statement doesn't get applied: if a post is in Members category and user is not logged in, it's supposed to ...
user avatar
0 votes
1 answer
96 views

How to check if the current page is at a specified path in the URL?

I have a page marked as the Posts page that lists most recent blog posts. It is at path /blog. I want to know when the user is on this page so that I can display a list of categories of blog posts at ...
user avatar
0 votes
0 answers
22 views

Display Most Recent Post Widget Title On Page

I want to display the Recent Posts Widget title on a page, however I could not find a solution yet. I dont want to display the recent posts on the page only the title of the most recent posts widget, ...
user avatar
1 vote
0 answers
296 views

WP Bakery Load More Button loads the same posts

I'm trying to feed posts in my blog page with a WP bakery widget. I have 8 posts published, but when I hit load more button it loads first 3 posts instead of those in the end. Attaching screenshots, ...
user avatar
2 votes
1 answer
373 views

Display the date before the post title in recent posts widget

In the recent posts widget I have the post link first, and the post date second item, How can I change, to display the date in front of the post title? Thank you. register_sidebar( array( '...
user avatar
0 votes
2 answers
20 views

How to Link to Most Recent Custom Post of Same Term

Title says it all. I'm trying to link to the most recent post of a custom post type, but only within the same term. Currently my code successfully echos the correct term ID but doesn't show a link ...
user avatar
0 votes
1 answer
22 views

The styles in the recent posts widgets plugin not working

I am trying to add a wordpress recent posts widget plugin in a theme but somehow even after adding the same class the styles ae not reflecting in the front end i tried to enqueue style in the plugin ...
user avatar
1 vote
0 answers
36 views

How do I exclude recent post from recent post php widget

I have this code, and I tried adding in post__not_in as suggested by another post I found on this website, and it didn't break anything but didn't work either. I also tried different examples. Here's ...
user avatar
0 votes
1 answer
237 views

widget_posts_args not using the number of posts in widget

So I'm using the widget_posts_args filter to pull in my custom post type posts inside the core 'Recent Posts' widget. Here is the code: add_filter('widget_posts_args', function() { $params['...
user avatar
  • 177
0 votes
2 answers
28 views

Custom recent-posts shortcode's thumbnail image not in line with rest of code

I'm making a custom recent-posts shortcode and I have a problem with the thumbnail image, it always shows it above everything else (permalink, title, etc...) even though I put it after in the code, is ...
user avatar
0 votes
0 answers
51 views

Linking to the most recent post in my podcast category

I am attempting to pulloff what the author did here: How can I link to the most recent post in a category? However, after updating my functions.php file in my child theme I can not get it to load the ...
user avatar
0 votes
1 answer
24 views

WordPress recent post

I have the static website template on the following domain : example.com and I have wordpress site in the sub domain : sub.example.com I want a code to get the latest post ( just post title ) from ...
user avatar
1 vote
1 answer
43 views

How to output only blockquotes content from recent posts in a widget?

I created a simple widget that displays recent post titles. How can I only display the content that is between < blockquote >< /blockquote > from recent posts? For example, all my posts have a ...
user avatar
  • 454
0 votes
2 answers
33 views

2 column recent post query not respecting float right [closed]

I am trying to display recent posts where I have one on the left showing the image, title, excerpt and author info and on the right, just the title, date and author information. I want it to show the ...
user avatar
0 votes
0 answers
81 views

Posts Per Page with a button to add more Posts

I have $recent_posts array with a 'posts_per_page' that look like thah: <?php $num_per_page = 3; $recent_posts = wp_get_recent_posts(array( 'posts_per_page' => $num_per_page, '...
user avatar
2 votes
1 answer
403 views

How to display recent / random posts by its category

trying to display random posts from each category that my custom post belongs to (it is related to 2 categories). I am trying to get post categories by id. I have tried to put category ID manually but ...
user avatar
  • 39
1 vote
1 answer
940 views

menu item to display the most recent post

I spent most of the day reviewing past questions and answers and have not found anything that addresses what I am trying to do. Maybe I didn't word my search correctly. Lets say I have a category of ...
user avatar
-1 votes
1 answer
13 views

Recent posts with different class name for each post and a scrollbar?

So far i found a widget ("Ultimate Posts Widget") with different class name for each post but it has no scroll bar.. any other widget suggestions ?
user avatar
  • 1
1 vote
1 answer
731 views

Use wp_get_recent_posts with search term

I have a function that uses wp_get_recent_posts() I need to use this same function on my search page but am having problems adding the search parameter to the $args array. Does anyone know if this ...
user avatar
  • 173
0 votes
2 answers
48 views

Is it possible to show thumbnails along with recent post from a wordpress blog on static website's homepage?

Please help me to figure this out that I want to show thumbnails along with recent post from a wordpress blog on static website's homepage. Following code are working fine but I need to show one ...
user avatar
2 votes
1 answer
594 views

If numberposts = -1 offset won't work

I have an issue with a shortcode I have built. The short code pulls the most recent posts based off of certain parameters. below are the parameters extract( shortcode_atts( array ( 'numberposts' ...
user avatar
  • 173
0 votes
1 answer
64 views

Proper way to display latest 5 posts grouped by post type?

i need to display the latest 5 posts of each post type, something like: Latest BMW Posts: Post title BMW 1 Post title BMW 2 Latest Audi Posts: Post title Audi 1 Post title Audi 2 And so on. It ...
user avatar
2 votes
1 answer
693 views

How to display recent posts added in several custom post types

So I have several custom post types on my site and would like to have a place on my home page that will show the most recent 6 posts from 3 different custom post types. I have looked at the setup on ...
user avatar
  • 65
0 votes
1 answer
60 views

'Recent Posts' links open in new window, without copying the 'WP_Widget_Recent_Posts' class

I have a requirement to have links on the 'recent posts' widget open in a new window (It's not something I would implement given the choice, but I've been asked to do it). I've found out that to ...
user avatar
  • 103
0 votes
1 answer
1k views

Display recent post by tag

I have 6 related posts by tag in every post. But some tags have only 2 or 3 posts. So in these posts, related posts section shows only 2 or 3 post. I want to complete related posts (if not 6) with ...
user avatar
  • 33
1 vote
3 answers
2k views

Change recent posts widget title

How can i change the recent post widget title programmatically? I use this code in my footer.php to add recent posts widget. <?php the_widget( 'WP_Widget_Recent_Posts' ); ?>
user avatar
  • 113
0 votes
2 answers
364 views

Display css ONLY on most recent post of specific category?

The below is just a scenario to provide context so you understand what im trying to accomplish, However please keep your answers related to the title if possible and a css solution/function. I have ...
user avatar
  • 255
0 votes
1 answer
348 views

How to display Most Recently Read 10 Posts by a logged in user in wordpress

I'm wordpress newbie and working on a website where users can register and maintain their profile. One of the main function of the logged in users is displaying their most RECENTLY READ 20 or 10 ...
user avatar
1 vote
2 answers
3k views

How to start with post number x?

I have two areas where I fetch the most recent entries. In the first area, I want to get the first 10 posts. In the second area, I want to fetch the posts starting at post number 11.... I have this: ...
user avatar
  • 193
0 votes
1 answer
544 views

How to filter wp_get_recent_posts() to only posts that have thumbnails?

I made a script that shows recent posts. But here's the problem, I want to show only posts that have thumbnails, and I want to show at least 10 posts if there are that many without thumbnails. So the ...
user avatar
  • 3
0 votes
1 answer
105 views

Sort / display recent posts by publish date

I recently renovated some sites and made many small (usually typos) corrections to several posts. That of course changed the last update date, so that now, if I display recent posts in a widget, they ...
user avatar
  • 113
-1 votes
1 answer
3k views

How to display recent posts on home page with title, post date, author and featured image?

I am looking to display some undecided number of recent posts (no more than 5) on my home page banner. For each post, I would like to display the title, post date, author and a featured images as ...
user avatar
  • 1
1 vote
2 answers
49 views

Two posts are loaded instead of one?

I am trying to add a read posts function to my Wordpress website. To achieve this, I create a cookie on which I store all the IDs of read posts. Every time a post is loaded, the following function is ...
user avatar
0 votes
1 answer
1k views

Add hero image to home page (blog format) via the dashboard

I am looking to add a hero image to my site's home page (blog format) via the dashboard. I have successfully used Advanced Custom Fields (ACF) to add hero images to static pages and posts. However I'...
user avatar
  • 23
0 votes
2 answers
806 views

Showing wordpress latest post thumbnails in slider with auto increment

I would like to show latest posts with its thumbnails only in slider. But my first figure element has a class. Can I apply a class to first thumbnail as it is in html structure below? And then Can I ...
user avatar
1 vote
2 answers
1k views

Recent Posts widget without Title

I want to add "Recent Posts" widget in a sidebar without a title but every time I add it, it shows "Recent Posts" text as title. How do I have it without title? I don't want to use any plugin for this....
user avatar
0 votes
2 answers
405 views

date_query problem

I'd like to get the closest post to today's post; yes, I checked and search this topic and found the code working for me: date_default_timezone_set("Europe/Warsaw"); setlocale(LC_ALL, en_GB); $year = ...
user avatar
0 votes
0 answers
932 views

Best way to add image to recent posts widget?

I want to add an image/thumbnail to the Wordpress recent posts widget. This is the only related question that I've seen and it uses filters and seems to be a bit round-about. I don't want to install ...
user avatar
  • 143
0 votes
1 answer
1k views

Modifying recent post widget to include icons for post titles

I have downloaded a plugin from the wordpress repository which allows adding font icons to the titles of posts, you can select a different icon for individual posts according to preference. Now, the ...
user avatar
  • 21
-1 votes
1 answer
1k views

How to filter content by language with WPGlobus

I am new in PHP and I cannot find the way or the programming logic to do this filter. I have the following code but I do not know how to filter it, Can anyone help me with the code? <?php ...
user avatar
  • 101
2 votes
2 answers
6k views

Display Custom Post Type in Recent Posts

I have the following problem: I have created a custom post type matratze and currently besides the custom posts no other posts exist. Hence, nothing is being displayed under the recent posts. The ...
user avatar
  • 367