tc66tc
Forum Replies Created
-
Forum: Plugins
In reply to: [Relevanssi - A Better Search] Comments not being searchedSorry, for clarification I mean it is not pulling in the posts with the comments in them that match the search. I have a phrase that is in the comments section of the post but that post is not showing up in the results.
The theme I am using does not use pre_get_posts, instead it calls the_post() function.
in functions.php
/***** Loop Output *****/ if (!function_exists('Aloop')) { function Aloop() { if (have_posts()) { while (have_posts()) : the_post(); get_template_part('loop', get_post_format()); endwhile; } else { get_template_part('content', 'none'); } } } add_action('A_loop_content', 'Aloop');
Call In index.php
<?php A_loop_content(); ?>
From query.php
function the_post() { 3492 global $post; 3493 $this->in_the_loop = true; 3494 3495 if ( $this->current_post == -1 ) // loop has just started 3496 /** 3497 * Fires once the loop is started. 3498 * 3499 * @since 2.0.0 3500 * 3501 * @param WP_Query &$this The WP_Query instance (passed by reference). 3502 */ 3503 do_action_ref_array( 'loop_start', array( &$this ) ); 3504 3505 $post = $this->next_post(); 3506 setup_postdata($post); 3507 }
I added this to my functions.php I am attempting to get this to only run when someone tries to view any category page.
/***** RATING SORT ADDITIONS *****/ add_filter('query_vars', 'add_vars'); function add_vars($new_query_vars) { $new_query_vars[] = 'rating'; return $new_query_vars; } function sort_by_rating($query) { global $wp_query; //i have a recipe section using it. change this to either the main posts or any post type archive.... if($query->is_archive()){ $query_rating = get_query_var('rating'); //checks the rating= in the url if(isset($query_rating) && $query_rating == 'topr') { $query->set('meta_key', '_kksr_avg'); $query->set('orderby', 'meta_value_num'); } if(isset($query_rating) && $query_rating == 'voted') { $query->set('meta_key', '_kksr_casts'); $query->set('orderby', 'meta_value_num'); } } } add_action('pre_get_posts', 'sort_by_rating');
Any ideas on how to attack this setup?
is this referring to the functions.php of the theme of the wp-include?
mbox99 I am looking to sort just my category pages by highest rated posts. I am unsure how to accomplish this. I am using the default app, I am new to this and not sure how to pull this off.