Categories
CMS Mastering Development Wordpress

WordPress blog pagination not working

Please let me know if anyone know .. <?php $per_page = 6; $paged = get_query_var(‘paged’) ? : 1; $offset = (1 === $paged) ? 0 : (($paged – 1) * $per_page) + (($paged – 1) * 2); $args = array( ‘post_type’=> ‘post’, ‘posts_per_page’ => $per_page, ‘post_status’ => ‘publish’, ‘order’ => ‘DESC’, ‘orderby’ => ‘ID’, ‘paged’ […]

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

WooCommerce – Get users list with their total order price in the last 30 days

I have users list in table with this code : $args = array( ‘number’ => $users_per_page, ‘paged’ => $current_page, ‘order’ => ‘ASC’, ‘orderby’ => ‘id’, ‘count_total’ => true, ); $get_all_users_mdp = new WP_User_Query($args); if($get_all_users_mdp->get_results()){ foreach($get_all_users_mdp->get_results() as $users){ $users_total_order[] = [‘username’ => $users->user_login , ’email’ => $users->user_email , ‘role’ => translate_user_role($wp_roles->roles[$users->roles[0]][‘name’]) , ‘totalOrder’ => number_format(get_user_orders_total($users->id) , […]

Categories
CMS Mastering Development Wordpress

show label text of select option rather than its value in cmb2

I am trying to display the label text of my CMB2 select not the value on the frontend. Currently my select field displays a list of a specific custom post type called fleet. When I add $gas = get_post_meta( get_the_ID(), ‘gas__assign’, true ); echo $gas; into the front of my website it is displaying the […]

Categories
CMS Mastering Development Wordpress

How to fetch posts with offset in WordPress?

I have more than 100,000 posts and i fetch 20,000 posts in every page refresh, but now if i refresh the page i want to display new 20,000 posts rather than same. Here is my Query $args = array( ‘post_type’ => ‘ebay_product’, ‘posts_per_page’ => 20000, ‘post_status’ => array(‘publish’), ‘orderby’ => ‘ID’, ‘order’ => ‘DESC’ ); […]

Categories
CMS Mastering Development Wordpress

Display a CPT based on a metabox selection

I am trying to display multiple post based off a custom metabox selection. I am currently using CMB2 as my framework to display the CMB within the backend. The selection field which has an ID of work__assign is calling all post titles from another CPT called fleet. Below is my code for displaying the CMB2 […]

Categories
CMS Mastering Development Wordpress

How to get a custom post with the largest ID (not the last post by date)

I would like to get the (one) post with the last ID, even if it is not the last post by date. The post belongs to a custom post type. I need this to assign custom id numbers to my orders. When creating a new order, I am going to find the post with the […]

Categories
CMS Mastering Development Wordpress

How to get a custom post with the largest ID (not the last post by date)

I would like to get the (one) post with the last ID, even if it is not the last post by date. The post belongs to a custom post type. I need this to assign custom id numbers to my orders. When creating a new order, I am going to find the post with the […]

Categories
CMS Mastering Development Wordpress

posts_per_page problem

I’m new here. So if I ask my question in wrong way, let me correct please. Anyway, here is my problem. I have a post category which has 22 sample posts. I created a shortcode with wp_query which has some criterias, like sorting by post id etc. I will create a few similar shortcodes for […]

Categories
CMS Mastering Development Wordpress

How to show Term ID beside Name Category with wp_dropdown_categories()

I have example code: <?php $defaults = array( ‘show_option_all’ => ”, ‘show_option_none’ => ”, ‘orderby’ => ‘id’, ‘order’ => ‘ASC’, ‘show_count’ => 1, ‘hide_empty’ => 0, ‘child_of’ => 0, ‘exclude’ => ”, ‘echo’ => 1, ‘selected’ => 1, ‘hierarchical’ => 1, ‘name’ => ‘cat’, ‘id’ => ‘mySelect’, ‘class’ => ‘postform’, ‘depth’ => 0, ‘tab_index’ => […]