Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › I can't get images to show for buddypress search results page
This topic contains 10 replies, has 2 voices, and was last updated by Ernest Marcinko 3 years, 9 months ago.
- AuthorPosts
- June 19, 2019 at 2:49 pm #23190
Hi, I’ve got this problem on my site where when you search for buddypress users, on the results page there are no avatars, just names, in one solid column. I can solve the layout problem with elementor, but try as I can I can’t get the avatars to show up. images show up for any other post type
June 19, 2019 at 2:58 pm #23191June 20, 2019 at 7:39 am #23197Hi,
Thank you for all the details. Unfortunately the plugin cannot affect the results page layout, it is fully controlled by the theme you are using. Usually themes support only post types with images, so profile images may not show there. It might be possible to get the images via a modification though. There is a theme function api available, but you will have to ask the theme author as well on how exactly modify the images within the theme files via a child theme.
In your case, you are looking to implement something like this, to pass the search images to the results page:
Best,<?php $asp_img = get_asp_result_field('image'); if ( !empty($asp_img) ) { echo "<img src='$asp_img'>"; } ?>
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
June 20, 2019 at 2:20 pm #23200Is this for groups only? I’m using Jupiter X, and I’ve added your code to the search.php fragment like this;
function jupiterx_post_image() { $asp_img = get_asp_result_field('image'); if ( !empty($asp_img) ) { echo "<img src='$asp_img' />"; }
after this, if I search for a term that affects both groups and users, the search reveals the groups images, but not the users.
You can see the result here;
June 20, 2019 at 3:05 pm #23204No, it should work with anytthing there. Mabye something is overriding those images, I am not sure.
Try maybe a bit more advanced modification:
Best,$asp_type = get_asp_result_field('content_type'); $asp_img = get_asp_result_field('image'); $asp_id = get_asp_result_field('id'); if ( !empty($asp_img) ) { echo "<img src='$asp_img' />"; } else if ( $asp_type == 'user' ) { if ( function_exists('bp_core_fetch_avatar') ) { $im = bp_core_fetch_avatar(array('item_id' => $asp_id, 'html' => false)); } else { $im = $this->get_avatar_url($asp_id); } if ( !empty($im) ) { echo "<img src='$im' />"; } }
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
June 20, 2019 at 3:09 pm #23205That did the trick 🙂 thank you so much Ernest, you’re a life saver
June 20, 2019 at 3:10 pm #23206You cannot access this content. Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
June 20, 2019 at 3:29 pm #23207just one last thing – if I click on a user’s name, the link takes me to /author/admin/ instead of members/admin. is this a theme thing as well?
-
This reply was modified 3 years, 9 months ago by
dando.
June 20, 2019 at 3:40 pm #23209don’t stress, I found the solution –
I’m putting it here in case anyone else has this problem, go to your functions.php and add this;
add_action(‘init’, ‘cng_author_base’);
function cng_author_base() {
global $wp_rewrite;
$author_slug = ‘members’; // change slug name
$wp_rewrite->author_base = $author_slug;
}This will modify the slug for authors
June 20, 2019 at 3:50 pm #23210can the_asp_result_field return a link to the profile?
June 21, 2019 at 8:54 am #23216Hi,
Not sure about that, it may not work, but if so, then it should return the same link as set here.
Best,<a href="<?php echo get_asp_result_field('link'); ?>">My link</a>
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
-
This reply was modified 3 years, 9 months ago by
- AuthorPosts
You must be logged in to reply to this topic.