Categories
CMS Mastering Development Wordpress

Display category posts before others category custom query [closed]

I have a page display some posts categories. So I want display before all post in my category 1 then, the others categories… So I want have: – display all posts in category 1 with descendent data after all posts I want display all other categories thanks I find the solution: So I have the […]

Categories
CMS Mastering Development Wordpress

Get Current Page ID in functions php, meta query filter

How do I get the Current Page ID in functions php when creating an meta query filter? I’ve made many attempts but all return Null. The filter works as expected when I manually input a number, but I need it to automatically echo the current post ID. Any guidance is appreciated, thanks. $args = array( […]

Categories
CMS Mastering Development Wordpress

Problem with adding programmatically woocommerce product post into category

I have problem with adding product to category when I creating this product. I have this code: $my_post = array( ‘post_type’ => ‘product’, ‘post_title’ => ‘Drukarka ‘.$_POST[‘marka’].’ ‘.$_POST[‘model’], ‘post_content’ => $_POST[‘opis’], ‘post_status’ => ‘publish’, ‘post_author’ => $current_user->ID, ‘taxonomy’ => ‘product_cat’ ); $post_id = wp_insert_post($my_post); wp_set_object_terms( $post_id, get_term_by(‘slug’, ‘druk-cyfrowy’, ‘product_cat’), ‘product_cat’); Var dump of: wp_set_object_terms( $post_id, […]

Categories
CMS Mastering Development Wordpress

Multiple Loops In Tabs Only Displaying First Loop

I’ve browsed all the other questions that could be related to this and still can’t find the answer. My code is only displaying the results of the loop in the first tab, but won’t show it in the second tab. Can’t figure out why. See code below: <div class=”tab-panels”> <div class=”panel entry-content active” id=”tab_all-lines”> <!– […]

Categories
CMS Mastering Development Wordpress

Check the stored / cached WP_Query with transients on post change

right now I have WP_Query stored for 24h (1day) with set_transient function. Everything works fine like it should. But if for example I change the post which is in the stored array to private or modify its meta_value, the post will still be seen on frontend. Any way to check if the post values have […]

Categories
CMS Mastering Development Wordpress

Get get Current Page ID in functions php, meta query filter

How do I get the Current Page ID in functions php when creating an meta query filter? I’ve made many attempts but all return Null. The filter works as expected when I manually input a number, but I need it to automatically echo the current post ID. Any guidance is appreciated, thanks. $args = array( […]

Categories
CMS Mastering Development Wordpress

Custom post taxonomies as tax_query terms?

I have these two custom post types called “product” and “reference”. On “references” I have attached a custom taxonomy called “product_reference” which I use to specify which products the references are related to. On the “product” custom posts I have attached a custom module called “module-relevant-references” for fetching reference-posts relevant to the product. This might […]

Categories
CMS Mastering Development Wordpress

Display ONLY ONE $term (Out of 4 terms) from a Custom Taxonomy and CPT

I hope someone can shed some light into this problem that i cannot find a solution for! (I have been searching the www for days). WHAT I HAVE DONE: I created a CPT: “service” and a Custom taxonomy: “service_cat”, which contains 4 $terms: corporate events, fundraisers, private events and weddings. I also created two files: […]

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 […]

Categories
CMS Mastering Development Wordpress

Where is the coding error for the unexpected ‘}’ in this if / else choice of loops?

an unexpected ‘}’ is reported for } else { <?php function mg_get_selected_taxonomy_dropdown_term() { return isset( $_GET[ ‘state’ ] ) && $_GET[ ‘state’ ] ? sanitize_text_field( $_GET[ ‘state’ ] ) : ”; } $selected_term = mg_get_selected_taxonomy_dropdown_term(); $states = get_terms(‘state’); $i = 0; if ($selected_term != “ALL”) { foreach ( $states as $state ) : $doctors = […]