Categories
CMS Mastering Development Wordpress

Set WP_query ‘order’ option by another tables value

I created like system in wordpress. And I created ‘sayim_beyenme’ table and created ‘say_post_id’ and ‘total_post_likes’ datas. Now I want to display my posts orderby total likes per each post. I get posts ids with array_map, but I dont know how can I order these posts by total_post_like values. For testing I have used ‘title’ […]

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

WP_Query inside foreach loop returning same value for all options when filtered using ajax

I am trying to build a timetable to display classes by time. I have a taxonomy of Day, which I am looping over to create a column for each day of the week. In side the column is a WP_Query which filters using the day taxonomy and meta_key classes_entry_start_time to orderby meta_value_num. The timetable is […]

Categories
CMS Mastering Development Wordpress

How to use pre_get_posts

I’m a little stuck on how this hook is used. Does it go in the search template, the archive page, or in functions? Does it surround the pagination code? Also, does it work differently when I’m querying a taxonomy archive page? I guess I may as well include all of my code here. Everything works […]

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

Categories
Mastering Development

How can I show specific posts on a Word Press page?

I have a page where I want to reference the titles from specific posts. This is my code with a loop right now – <?php $args = array( ‘post_type’ => ‘post’, ‘order’ => ‘ASC’, ‘cat’ => ‘3’, ); $product_posts = get_posts( $args );?> <p> <?php foreach ( $product_posts as $post ) : setup_postdata( $post ); […]

Categories
Mastering Development

Woocommerce Product Archive Page for Custom Taxonomy

I registered a custom taxonomy for WooCommerce products. Additionally, I set up a page template to list up all entries of the custom taxonomy with taxonomy archive links. Now I have the problem, that the archive links are not working. I was expecting them to work similarly to the product category and product tag archive […]