Categories
CMS Mastering Development Wordpress

Meta query with order by another custom field

Edit: I will try to explain in detail my problem. I am working on a portfolio site. There are a few custom post types: Projects, Publications, Exhibitions, Lectures and Slides. Home page consists of following sections: slider with Slides portfolio consisting of: selected (marked by Client) Projects, Publications, Exhibitions and Lectures and remaining Projects, Publications, […]

Categories
CMS Mastering Development Wordpress

How to display user order by role

I am trying to display user on query but i want to display order by user role. Suppose we have 2 user role, Gold and Free. I want to display Gold user first and then free users. $args = array( ‘order’ => ‘ASC’, ‘orderby’ => ‘display_name’, ‘role__not_in’ => ‘administrator’, ‘posts_per_page’ => 10, ‘meta_query’ => array( […]

Categories
CMS Mastering Development Wordpress

Meta query with order by another custom field

I query custom posts using wp_query’s meta_query. What I try to achieve: firstly, to show posts with meta_key “sticky_home” ordered by another meta_key “sticky_home_order” value (from 1 to 10). secondly, to show remaining posts ordered by date (descending). I know it is simple in two queries, but I need it in one query in order […]

Categories
CMS Development Wordpress

Filter post by tag

Iive found the next example to make filters on my site by tag: https://www.bobz.co/ajax-filter-posts-tag#comment-28112 But is working not like i spected… I’ve added on my functions.php: function ajax_filter_posts_scripts() { wp_register_script(‘afp_script’, get_template_directory_uri() . ‘/assets/js/olv_test.js’, false, null, false); wp_enqueue_script(‘afp_script’); wp_localize_script( ‘afp_script’, ‘afp_vars’, array( ‘afp_nonce’ => wp_create_nonce( ‘afp_nonce’ ), ‘afp_ajax_url’ => admin_url( ‘admin-ajax.php’ ), ) ); } add_action(‘wp_enqueue_scripts’, […]

Categories
CMS Development Wordpress

WP_Query not using custom taxonomy categories on custom post type

So I have both a custom post type which is called ‘Recipes’ in my register method() as shown below: public static function register() { add_action(‘init’, function() { $labels = array( ‘name’ => __(‘Recipes’), ‘singular_name’ => __(‘Recipe’), ‘nickname’ => __(‘Recipe’), ‘add_new’ => _x(‘Add Recipe’, ‘Recipe’), ‘edit_item’ => __(‘Edit Recipe’), ); $args = array( ‘labels’ => $labels, […]

Categories
CMS Development Wordpress

Add “All Posts” button to custom post taxonomy filter with ajax in wordpress

Does somebody know how to add “All Posts” button to my custom post (“albums”) with custom taxonomy (“album_category”)? I can see my categories (Mixing, Mastering, Production) and when I click on them it shows me the posts that have been ticked under the certain category (Mixing, Mastering, Production). What I want is to have also […]

Categories
CMS Development Wordpress

Add “All Posts” button to custom post taxonomy filter with ajax in wordpress

Does somebody know how to add “All Posts” button to my custom post (“albums”) with custom taxonomy (“album_category”)? I can see my categories (Mixing, Mastering, Production) and when I click on them it shows me the posts that have been ticked under the certain category (Mixing, Mastering, Production). What I want is to have also […]

Categories
CMS Development Wordpress

Server cron job not working

I want to setup server cron job for my WordPress website. This is what I have done so far. I added this line to my wp-config file. define(‘DISABLE_WP_CRON’, true); I added this command for setting up cron job. wget -q -O – https://example.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1 But my cron function is not working. I setup cron […]

Categories
CMS Development Wordpress

how to show entries related to main category

I have an entry with the following category and subcategory -Crops —fruit —-papaya (Main) The problem is that when I show the related articles, it shows me all the entries of the category (crops) and not of the subcategory that you select as main (papaya) this is the code i have: $terms = get_the_terms( get_the_ID(), […]

Categories
CMS Development Wordpress

Sort posts of a particular category based on custom date field value, and display in ascending order

I’m working on displaying a listing of posts that have a an advanced custom field Date Picker, and I need to display all upcoming posts in ascending order. So far I can get the wp_query to show all upcoming posts in descending order (i,e. Dec 26 2019, Dec 13 2019, Nov 26 2019), but this […]