Combine multiple words in custom meta search query

Split the search query by white space and change ‘compare’ to ‘IN’ to be able to use meta values array: <?php $s = get_search_query(); $s_array = explode( ‘ ‘, $s ); // search query array $args = array( ‘post_type’ = > ‘product’, ‘meta_query’ = > array( ‘relation’ => ‘OR’, array( ‘key’ => ‘vbs_author’, ‘value’ => … Read more

Show attribute description when filtering by that attribute

You need to check when filter is enabled and take selected attribute taxonomy, ‘pa_brand’ in this case: add_action( ‘woocommerce_before_shop_loop’, ‘desc_before’, 75 ); function desc_before() { if (is_filtered()) { $brands = WC_Query::get_layered_nav_chosen_attributes() [‘pa_brand’]; if ( isset($brands) ) { foreach ($brands[‘terms’] as $term ) { $term_obj = get_term_by(‘slug’, $term, ‘pa_brand’); echo ‘<div class=”ka-attr-description”>’. ‘<h4>’ . $term_obj ->name … Read more

Custom php file in wordpress

Andrew Bartel is on the right path, but the link doesn’t quite do what you want. For static PHP files to access WordPress core functionality you need to add this to the top of the PHP file: define(‘WP_USE_THEMES’, true); /** Loads the WordPress Environment and Template */ require( dirname( __FILE__ ) . ‘/wp-blog-header.php’ ); (This … Read more

Theme Twenty Fifteen: Customize Color Scheme Customizer

It seems that you are modifying directly the twentyfifteen_get_color_schemes() function on parent theme or redeclaring it on your child theme. You should avoid both cases. In the original code from twenty fifteen can see this: apply_filters( ‘twentyfifteen_color_schemes’, array(…..) ); That means that you can create a filter to add extra color schemes in this way: … Read more

Adding extra info via GET while registeration in wordpress

I’ve recently written an affiliate plugin where i had to do pretty much the same stuff. Here’s a chopup of the relevant parts: To process the extra info you get from the registration form: add_action(‘user_register’, ‘my_handle_signup’, 10, 2); function my_handle_signup($user_id, $data = null) { $reg_ip = $_REQUEST[‘reg_ip’]; $referrer = $_REQUEST[‘referrer’]; if (isset($reg_ip) && isset($referrer)) { … Read more