Categories
CMS Mastering Development Wordpress

WordPress subcategory archive pagination in custom layout

I have blog with categories and sub-categories and use category.php for archive of main category posts, and added a custom layout for subcategory archive layout as subcategory.php (with a function). In this subcategory archive page, I need a numbered pagination but all I did it returns to 404 Not Found, here my code : function […]

Categories
CMS Mastering Development Wordpress

Having trouble with custom date field for CPT query (WordPress)

I’ve read as many of the questions and answers on here as I can find and none of the solutions are working for me. No idea what I’m doing wrong here. I have a CPT ‘event’ with meta key ‘start_date’ – This saves to DB in YYYY-MM-DD HH:MM:SS format exactly the same as the standard […]

Categories
CMS Mastering Development Wordpress

WordPress pagination problem on merged queries

I have merged queries in search.php with custom post types. This is my scenario when user search to "math", the main query is searching in the post title, post excerpt, and post content. Now I have a "math" category but the post information is not including "math" text which exists in the math category so […]

Categories
CMS Mastering Development Wordpress

How to Display Custom Formatted Blog Post with Provide tag name as attribute in Shortcode

I want to make Shortcode where if client pass the name of tag(available or added in blog posts) as attribute then it will show 2 blog post from that mentioned tag. as i cannot ask him to do all html static code and his placement of posting the blog in case study is not fixed […]

Categories
CMS Mastering Development Wordpress

First x post with another template then the others

I want to output the 5 latest posts. But the template of the first 2 must be different than the other 3 posts. So I’ve created two queries. The first one shows the 2 posts: <?php $loop = new WP_Query( array( ‘post_type’ => ‘Post’, ‘posts_per_page’ => 2 ) ); ?> <?php while ( $loop->have_posts() ) […]

Categories
CMS Mastering Development Wordpress

WordPress Pagination Issue, displaying first page only

I have searched through the forms and can’t find a solution that is working. I have this exact code on another site and it works. Not sure why it’s not working here. All it’s doing is ever showing the first page of posts, and never shows a "newer" posts link (prev vs next button) My […]

Categories
CMS Mastering Development Wordpress

posts_per_page not working in block

I have created a new Block for the WordPress Editor, and I am trying to get a simple WP_Query to work, but so far, the $args in the query are mostly ignored, apart from the post_type setting. For example, I want to set posts_per_page to 3, but this is ignored. Why is this? <?php wp_reset_postdata(); […]

Categories
CMS Mastering Development Wordpress

Multisite Ajax Pagination?

I am usijg Multisite and have the below code which pulls in posts from 2 sites. How can I add Ajax “Load More” pagination to the below code? Ideally when a “Load more” button is clicked it displays the next set of posts on the page. $allPosts = []; $sites = array( 2, 1 ); […]

Categories
CMS Mastering Development Wordpress

How to get post from all custom post_type multisite to the main site with pagination ordered by date?

Currently this is my WordPress Multisite: Main site -Sub Site -Sub Site -Sub Site -Sub Site and this is the example code for getting all post from multisite : foreach( $blog_ids as $id ) { switch_to_blog( $id[‘blog_id’] ); $args = array(‘post_type’ => ‘events’, ‘posts_per_page’ => 2,’paged’ => $paged, $meta_query = array( ‘relation’ => ‘OR’, array( […]

Categories
CMS Development Wordpress

WordPress Pagination for Custom Post Type returns Same Post on every Page

The Pagination for my custom post type returns the same posts on every page. Like when hovered over the pagination like the link shows domain.com/android/page/2 but when clicked it returns to domain.com/android/ with the same content. Here is my Custom Post Type Code: register_post_type( ‘Subject’, array( ‘capability_type’ => ‘Subject’, ‘map_meta_cap’ => true, ‘show_in_rest’ => true, […]