Tag Info

New answers tagged

2

Not in the url, but you can pass other parameters in the groups loop. There is a search_terms parameter in bp_has_groups(). It also has an orderby parameter that accepts total_member_count as the property. Assuming the tag info is stored in group_meta, you can add a meta_query parameter to the bp_has_groups(). More info from the BuddyPress codex.


0

Assuming you are using post_meta this should help:: $color = 'red'; $the_query = new WP_Query(array( 'meta_key' => 'color', 'meta_value' => $color ));


0

This is completely untested but I believe you would want something along these lines: <?php if( $loop->have_posts() ): while ( $loop->have_posts() ): $loop->the_post(); // Do stuff for results echo '<h2>' . the_title() . '</h2>'; // Check for tag if(has_tag($tag) { output HTML if true } endwhile; ...


0

The above solutions break the page if the search term appears inside HTML tags. You should use something like: $regEx = '\'(?!((<.*?)|(<a.*?)))(\b'. implode('|', $keys) . '\b)(?!(([^<>]*?)>)|([^>]*?</a>))\'iu'; $text = preg_replace($regEx, '<strong class="search-highlight">\0</strong>', $text);


0

Have you check your result-set, what result you are getting in $query obj. another thing, there is no need to use 'relation' => 'OR', in meta query array, have a try with this as well. And instead of 'numberposts' use 'posts_per_page' this will help. :) or you can remove the meta_query and make your $arg something like $args = array( 's' => $keyword, ...


0

It looks like you aren't actually grabbing the search query in your form. You need to include value="<?php the_search_query(); ?>" in your input field. Here is a link to the docs for the search form. I think what you're looking for is under the 'Theme Form' heading.


0

With Wordpress 4.2.2 I'm using the following (admittedly fragile) method to search excerpts as well as the content and title without a plugin. This is the relevant snippet from functions.php. add_filter('posts_where', 'custom_posts_where'); function custom_posts_where($where) { if (is_search()) { $where = preg_replace( ...


0

The issue was with the category name, it started with a number..! I changed it into a string and it now works. 5 hours later....


2

This is just a normal plugin. You can install it by doing the following: On the Github Page click "Download Zip" button on the right side. On your WordPress admin panel navigation to Plugins Click "Add New" button at the top of the page which will take you to the "Add Plugins" page. Click "Upload Plugin" button at the top which will allow you to upload and ...


1

Did you search the endless expanses of the internet ? Because the first entry on the SERP is an article at the relvanssi knowledge base, with the title ┬╗Separating posts by post type┬ź, sounds fitting to me. Below is the code for the proposed approach: add_filter('relevanssi_hits_filter', 'separate_result_types'); function separate_result_types($hits) { ...


2

You are getting your post results in the order that the Relevanssi plugin thinks is correct. That is, you are getting the results in the most relevant order according to the plugin's logic (I don't know what that is exactly) which is the point of the plugin. Generally speaking, ordering by post type isn't that hard: function orderby_type($orderby) { ...


3

Here is an idea, sort your your loop before it executes. Your current issue is just this. You will see that the type of sorting (if I'm correct where I believe your order is not alphabetical according to post type) is not possible natively, so we need a work-around (even if you just need post types sorted alphabetically, the native way still lack proper ...


1

I can confirm that url-decoding the search query is the correct approach. In fact, it is done in WordPress core for the search parameter of WP_Query but not when the search string is from a $_GET request as it is seen in WP_Query::parse_search() method, wp-includes/query.php#L2061 (WP 4.2.2): if ( empty( $_GET['s'] ) && $this->is_main_query() ) ...


0

The get_search_form function doesn't work like that. The parameter that is accepted only specifies if the HTML content is being returned or outputted directly. So this parameter should be a boolean. It still works in your case because PHP simply evaluates the string that you are passing as true considering that it is not an empty string, 0, null etc. It ...



Top 50 recent answers are included