rajanshrestha
Forum Replies Created
-
Forum: Plugins
In reply to: [ACF: Better Search] This does not work with User ACFfor search I am using this function
This is working fine on searching post with post title, post content and from ACF fields on post. but not from author.add_action( ‘wp_ajax_search_cposttype’, ‘searchCposttypeByTerm’ );
add_action( ‘wp_ajax_nopriv_search_cposttype’, ‘searchCposttypeByTerm’ );function searchCposttypeByTerm() {
//$authors=get_users();
$wp_query = new WP_Query(array(
‘post_type’=>’cposttype’,
‘post_status’=>’publish’,
‘s’ => $_GET[‘searchTerm’]));while ($wp_query->have_posts()) : $wp_query->the_post();
get_template_part(‘template-parts/cposttype/cposttype-post’);endwhile;
wp_die();}
- This reply was modified 8 years, 3 months ago by rajanshrestha.
- This reply was modified 8 years, 3 months ago by rajanshrestha.
Forum: Plugins
In reply to: [ACF: Better Search] This does not work with User ACFHi
I also tried to call the user name, using field type ‘User’
It displayed the User Name on eash post by using
<?php
$values = get_field(‘ztest’);
if($values){
$array = array_values($values);
echo $array[5];
}
?>but when I search on WordPress Search input box, it gives search result with other ACF values but did not give search result from ACF field type ‘User’ value.
The author name could be displayed by using only below code
<?php the_author_meta( ‘display_name’ ); ?>
but no search result from both of this.Please could you help me on this.
Thanks