Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Show Image in Search Results (Pods)
- This topic has 13 replies, 2 voices, and was last updated 3 years, 6 months ago by
Ernest Marcinko.
-
AuthorPosts
-
March 25, 2021 at 9:08 pm #32331
sakshamtalwar67
ParticipantHi Team,
I implemented the search engine on my website and want to show the pods term meta (image) as well. I tried using _pods_cp_store_image and cp_store_image but none of them work. Can you please help me out here? This is kinda the primary function I needed this plugin for
March 25, 2021 at 9:31 pm #32332sakshamtalwar67
ParticipantYou cannot access this content.
March 26, 2021 at 10:50 am #32344Ernest Marcinko
KeymasterHi,
Thank you for the details. I checked the issue via the back-end, and made an adjustment to the terms image parser. Now the images should be returned correctly (via the cp_store_image field)
March 26, 2021 at 11:05 am #32345sakshamtalwar67
ParticipantAmazing, that was quick. I just checked and it works!! Thanks a lot!
Also is there a way to show an extra text field in place of description? The description should be replaced by another Pods field cp_store_website or remove the Description field and display this field instead
March 26, 2021 at 11:16 am #32348Ernest Marcinko
KeymasterYou are welcome.
Well, it depends, it might be doable programmatically. Try adding this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!
add_filter( "asp_results", "asp_term_meta_desc", 10, 1 ); function asp_term_meta_desc( $results ) { // Field name $field = 'cp_store_website'; // ---------------------------------------------- // --- Do not change anything below this line --- // ---------------------------------------------- foreach ( $results as $k => &$r ) { if ( $r->content_type == 'term' ) { $s = get_term_meta( $r->id, $field, true ); if ( !empty($s) ) $r->content = $s; } } return $results; }March 26, 2021 at 11:32 am #32349sakshamtalwar67
ParticipantThat worked!! You rock Ernest!! Is there a way to reduce the highlighted space and blue border thickness?
March 26, 2021 at 1:49 pm #32352Ernest Marcinko
KeymasterSure, you can change the margin between the box and the results here. The padding between the items and the container is fix, but you can change the background of it to white, and add individual border: https://i.imgur.com/QLpTmfi.png
March 26, 2021 at 2:55 pm #32361sakshamtalwar67
ParticipantI made the margin to 0 but there’s still some space. I tried to make the margin negative but it doesn’t let me enter a negative value. I ideally want the results box to be stuck to the search box
March 26, 2021 at 3:06 pm #32364sakshamtalwar67
ParticipantAlso is there a way in mobiles the search bar is hidden but only a search icon is shown. When a user clicks on the icon the bar becomes visible?
March 26, 2021 at 3:27 pm #32367Ernest Marcinko
KeymasterTry forcing it via custom CSS:
.asp_r_1 { margin-top: -14px !important; }It is possible to use the compact layout mode, but it is hard coded for all devices. You may have to create two separate search bars, one for mobile and one for desktop. Then on the General Options -> Mobile panel you can hide one from mobile one from desktop.
March 27, 2021 at 3:18 pm #32377sakshamtalwar67
ParticipantGotcha! Is there a way to disable the plugin if the URL contains a parameter? I am able to detect the URL and check if-else conditions on it but not sure how to disable/prevent scripts/css from loading.
March 29, 2021 at 1:11 pm #32391Ernest Marcinko
KeymasterThere is a conditional asset loader feature, otherwise you can use the asp_load_css_js filter for programmatical solutions.
November 7, 2022 at 1:25 pm #39886sakshamtalwar67
ParticipantIs there a way to show content from two fields in the search results. One visible and one hidden
November 7, 2022 at 2:26 pm #39890Ernest Marcinko
KeymasterYes – use the advanced title and content fields for that.
-
AuthorPosts
- The topic ‘Show Image in Search Results (Pods)’ is closed to new replies.