Exclude the Newest Recent Post from their Category After New post Publish old post should be in their category at Home Page
Exclude the Newest Recent Post from their Category After New post Publish old post should be in their category at Home Page
Exclude the Newest Recent Post from their Category After New post Publish old post should be in their category at Home Page
You can use the WP Query option “post__not_in” for that, this variable should be an array with IDs of posts that should not appear on the result, so you would use it like that: $the_query = new WP_Query(array( ‘post__not_in’ => array( get_the_ID() ), ‘post_type’ => ‘articles’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => 1, ‘orderby’ => ‘date’, … Read more
At first you need to set a meta value when a post is visited using this way if( is_user_logged_in() ) { update_post_meta( $post_id, ‘post_readed_by’, get_current_user_id() ); } Then you can get the recent visited posts <?php $args = array( ‘posts_per_page’ => 10, ‘meta_key’ => ‘post_readed_by’, ‘meta_value’ => get_current_user_id(), ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ); … Read more
‘;’ is missing in this line echo “<dt>$recent_date / <span class=”comment”><a href=”$recent_link#disqus_thread”>$recent_count</a></span></dt><dd><a href=”$recent_link” title=”$recent_title”>$recent_title</a></dd>” For this reason code is throwing the fatal error. Please replace that line with this code echo “<dt>$recent_date / <span class=”comment”><a href=”$recent_link#disqus_thread”>$recent_count</a></span></dt><dd><a href=”$recent_link” title=”$recent_title”>$recent_title</a></dd>”;
To do this we will need to do 2 queries: 1) Get a list of all the users on the site via wp_user_query 2) Get posts from all the users using wp_query The code: $user_query = new WP_User_Query( ‘Author’ ); if ( ! empty( $user_query->results ) ) { foreach ( $user_query->results as $user ) { … Read more
Put this in your sidebar template where you want the listing to show up. Alternatively, you could use a plugin that allows you to run php in widgets and then place directly in a widget box, but that’s not always wise. <?php $categories = get_the_category(); $category = $categories[0]; $category_id = $category->cat_ID; $args = array(‘category__in’ => … Read more
You can try using Vertical Scroll Recent Post plugin. It enables you to scroll the recent posts vertically. You can specify the number of posts to scroll. You can also choose the category and the order. .
In this part of the code: ‘<h5>’. $recent[“post_title”].'</h5> the post_title should be filtered for WPGlobus to get the current language part. Like this: ‘<h5>’. apply_filters( ‘the_title’, $recent[‘post_title’] ) .'</h5>
The functions you are looking for, are: the_post_thumbnail_url(); // For featured image the_author(); // For author name get_author_posts_url(); // For author link the_date(); // For post’s date So, your code should be something like this: <div class=”cs-post-carousel-layout”> <div class=”cs-container swiper-container”> <div class=”swiper-wrapper”><?php // define query arguments $args = array( ‘posts_per_page’ => 5, // your ‘x’ … Read more
Do a WP_User_Query and then go through the results: $wp_user_search = new WP_User_Query( array( ‘role’ => ‘author’, ‘fields’ => ‘all_with_meta’ ) ); $editors = $wp_user_search->get_results(); echo ‘<pre>’; print_r( $editors ); echo ‘</pre>’;