Categories
CMS Mastering Development Wordpress

How to cascade Gutenberg SelectControl component

How can I cascade the SelectControl component in Gutenberg editor. My exact requirement is as following: My first select list contains post meta fields and on the second select list, I want to display the posts that have the post meta that was selected in the first select list. I use getEntityRecords with custom query […]

Categories
CMS Mastering Development Wordpress

page shows short code not output

Written the following code in a custom file inside theme folder and called it via functions.php but at page [product_first_img] shows short code text not output. function gal_first_shortcode( $atts, $content = null ) { extract( shortcode_atts( array( ‘size’ => ” ), $atts ) ); $image_size = ‘medium’; if($size =! ”) { $image_size = $size; } […]

Categories
CMS Mastering Development Wordpress

Query by more than one menu_order value

I’m trying to write a query to get certain posts based on their menu order value. What I specifically want is to get the two previous posts and the next two posts. So $more_than_one_menu_order_value = "4,5,7,8" or $more_than_one_menu_order_value = array(4,5,6,7) (the current post being 5 for example). But I don’t think ‘menu_order’ takes multiple values, […]

Categories
CMS Mastering Development Wordpress

Filters post by subcategory slug using buttons

I load in subpage post with one category now i try filter this post by him subcategory and get link to page some like mypage.com/subpage/?slug=fish after click button and see only fish post. I should use $_GET? Anyone can help? There is my code who load all my post from category animals <?php $args = […]

Categories
CMS Mastering Development Wordpress

$post->ID not working in combination with a custom query

What is the reason that $post->ID is not working in metabox_callback after adding a custom query. How can I avoid this? Should I use $post_id = isset( $_GET[‘post’] ) ? $_GET[‘post’] : ( isset( $_POST[‘post_ID’] ) ? $_POST[‘post_ID’] : false ); instead of $post->ID? Similar question/same situation here. What is the reason for problems like […]

Categories
CMS Mastering Development Wordpress

Ajax filter – show all results that contain at least one filter

For a project I use Timber (TWIG) with WordPress. I’m trying to implement ajax filter with tags on a video template. But it doesn’t work like I would like. For the moment my system is too strict. Filters combine in the wrong way. Example : Video 1 tags : media // digital // health Video […]

Categories
CMS Mastering Development Wordpress

How to get 2nd or 3rd image of woocommerce image gallary with [shortcode]

I am using following code to view the first image of woo-commerce product images with the shortcode of [product_first_img] function gal_first_shortcode( $atts, $content = null ) { extract( shortcode_atts( array(‘size’ => ”), $atts ) ); $image_size = ‘medium’; if($size =! ”) { $image_size = $size; } $images = get_children(array( ‘post_parent’ => get_the_ID(), ‘post_type’ => ‘attachment’, […]

Categories
CMS Mastering Development Wordpress

Search product by brand name in wp_query

I use this to search product by name on 2 categories: <ul class=”products”> <?php $paged = ( get_query_var( ‘paged’ ) ) ? absint( get_query_var( ‘paged’ ) ) : 1; // Request is empty, view all products based url cat ID if($tmp == ”) { $args = array( ‘post_type’ => ‘product’, ‘s’ => $tmp, ‘posts_per_page’ => […]

Categories
CMS Mastering Development Wordpress

How to get images from EDD post?

I use Easy Digital Downloads plugin and I wish to get images from the downloads posts types! But with my code, nothing return! Someone for help? <?php $attachments = get_posts( array( ‘post_type’ => ‘attachment’, ‘orderby’ => ‘menu_order’, ‘numberposts’ => 5, ‘post_status’ => null, ‘post_parent’ => $post->ID, ‘post_mime_type’ => ‘image’ )); if ( $attachments ) { […]

Categories
CMS Mastering Development Wordpress

Custom WP_Query not acknowledging search category & tag at the same time, but work independently

I have elaborate search functionality on one of my sites, it is using a custom WP_Query that will allow for an ‘AND’ & ‘OR’ relation between the users selections. It will then generate the result and overwrite the existing products in the product list. This is all being done using AJAX and a function within […]