Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › A couple questions
- This topic has 13 replies, 2 voices, and was last updated 9 years, 7 months ago by
Ernest Marcinko.
-
AuthorPosts
-
October 4, 2016 at 11:33 am #10356
Brett Golding
ParticipantHi,
Just purchased your plugin. Great so far but I have just a couple of small issues.
1. I am having trouble overriding the CSS. Either with an external stylesheet or your inline customizer. I am trying to change the background colour of the search bar. It has saved and updated but the changes do not reflect on the live site.
2. I have some custom fields associated with a post type that I am using to search through. URL’s and icons that link to social media profiles. You will see on the site a demo of what I had setup previously, under sponsored anglers, setup before using your plugin. Is there a way for me to modify the theme files to include these links still on the front end? Can you point me in the right direction?
3. The top search on the page I have sent you is displaying WooCommerce results. How do I limit these results to only blog posts and nothing else?
Thank you very much for your time and keep up the good work.
Brett.
October 5, 2016 at 1:55 pm #10370Ernest Marcinko
KeymasterHi!
1. In some cases you will have to change the input field background as well because it might overlay the whole search bar. You can find it on the Theme Options -> Input field layout panel: http://i.imgur.com/EDHtvJt.png
2. It might be possible.
I’ve looked up a support thread where someone was using the social feather plugin, and I was able come up with a solution to include the icons on the front-end results: https://goo.gl/C6yk66Other possible resources:
One is to use a filter to modify the results content to append the extra html code of the icons there. There is a tutorial on how to add WooCommerce add to cart buttons to results, which I believe is a good starting point: https://goo.gl/pVye7eAnother one is to directly edit the plugin template files. Here is a detailed guide on how to do so: https://wp-dreams.com/knowledge-base/result-templating/
3. On the General Options -> Sources panel you can select which post types to include. I believe you only need to enable the “Search in posts” option in this case. If the blog posts are in a specific category, you can also set up to include items from only that category on the Advanced Options -> Exclude results panel: http://i.imgur.com/ku0MbUD.png
October 6, 2016 at 12:30 pm #10385Brett Golding
ParticipantThank you for the response. Do you know why in the CSS section when I enter custom CSS code why it is not saving?
October 6, 2016 at 4:02 pm #10386Ernest Marcinko
KeymasterYou mean the ajax search pro custom css on the Theme Options -> Custom CSS section?
I just logged in and tried a random CSS, but it did save for me for some reason. I suspect it might be either maybe a browser plugin or an unknown bug yet.
Can you try:
– After copy/pasting the custom CSS, enter one more character and then just delete it. It might trigger the value change event, which I suspect is somehow not working correctly.
– ..if that doesn’t work, try without browser plugins enabled
– ..if none of this work, maybe a different browser? (preferably google chrome or mozilla firefox)October 6, 2016 at 4:30 pm #10387Brett Golding
ParticipantThanks Ernest,
My external stylesheet seems to be overriding everything ok.
With regards to my second point. I have studied the post you referred me to and tried testing by adding the following to my functions file…
[code]add_filter(‘asp_results’, ‘asp_social_shortcode’, 1, 1);
function asp_social_shortcode( $results ) {
foreach ($results as $k => $r) {
$r->content .= "<p>Hello World!</p>";
}
return $results;
}[/code]Unfortunately, it hasn’t done anything.
I am outputting these custom fields with a loop as seen below.
[code] <?php
//Define your custom post type name in the arguments
$args = array(‘post_type’ => ‘sponsored_anglers’);//Define the loop based on arguments
$loop = new WP_Query($args);//Display the contents
while ($loop->have_posts()) : $loop->the_post();
$src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), array(5600, 1000), false, ”); ?><div class="social-icons">
<a target="_blank">"></a>
<a target="_blank">"></a>
<a target="_blank">"></a>
<a target="_blank">"></a>
</div><?php endwhile; ?>[/code]
Do you have any idea how to include these fields? They need to be present all of the time. I am preloading results as you can see from my site.
October 7, 2016 at 10:42 am #10390Ernest Marcinko
KeymasterHi!
I believe it’s because as I see the results content display is turned off, therefore the change is not visible. So first of all, you need to make sure it’s turned on. Go to the Layout Options -> Results layout panel and turn on the “Show description in results?” option: http://i.imgur.com/Pj0lnKu.png
After that, the content should become visible on the front-end.
In the second code you provided I cannot actually see any custom fields parsed, but I guess you want the social icons HTML part to be appended to the end of the description:
October 11, 2016 at 6:16 pm #10445Brett Golding
ParticipantThanks Ernest for coming back to me.
If you take a look at my ‘community.php’ page template file. You can see on line 343 onwards how I had set up the Custom Fields and passed in the Social Media URL’s before installing this plugin.
Basic while loop.
I have pasted your code into my functions.php file but it has had no effect. When I view the source code I am unable to locate the ‘social-icons’ div.
What I am trying to achieve here is the social HTML icons under each Angler. However, stored in WordPress are unique URL’s for each Anglers social media feed.
This is why I was previously using a loop in combination with the ACF plugin. To output the following.
(see image, this text field is breaking my code)
Under each Angler there were listed 4 social media icons, and the href for each icon was unique to the custom field inputted inside of that Anglers post in the backend of WordPress.
I hope this makes more sense.
-
This reply was modified 9 years, 7 months ago by
Brett Golding.
-
This reply was modified 9 years, 7 months ago by
Brett Golding.
-
This reply was modified 9 years, 7 months ago by
Brett Golding.
October 11, 2016 at 6:56 pm #10450Ernest Marcinko
KeymasterOh I see why now, there is one missing “&” sign in the foreach loop code, dang it!
Additionally, based on your screenshot I’ve constructed a possible solution, including getting the fields and checking if they are empty as well. The “the_field” function would not work in this case, as this is not a classic wordpress posts loop, so each field needs to be parsed separately:
I actually haven’t tested this code, but I’m almost sure it will place the HTML code into the results.
October 14, 2016 at 4:31 pm #10477Brett Golding
ParticipantYou cannot access this content.
October 17, 2016 at 9:50 am #10482Ernest Marcinko
KeymasterHi Brett,
After I turned on the “Show description (content) in results?” option, the code appears to be working , the HTML code is there, but there are no styles applied it so it’s basically invisible: http://i.imgur.com/XuNnlJo.png
I’ve looked into the style.css file in the theme directory, and the social icon CSS is exclusive to an entry element, so it won’t apply to the search results. I recommend adding these changed rules to the style.css file in the theme directory as well:
These are more generic rules, will apply to the search result elements as well.
October 18, 2016 at 6:57 pm #10509Brett Golding
ParticipantYour awesome mate, thank you so much.
I don’t suppose you know how to disable the links to the actual Angler pages do you? I am only looking to have the social icons clickable.
Also in the search bars, they all say ‘search posts’. Is there a setting in the admin panel to change this text? I’d like it to say, for example, ‘search anglers’.
Many Thanks.
October 19, 2016 at 12:49 pm #10523Ernest Marcinko
Keymaster“I don’t suppose you know how to disable the links to the actual Angler pages do you? I am only looking to have the social icons clickable.”
Actually, I know a very simple javascript trick for that. I suppose you only want the sponsored angler search results affected. In this case:Simply put this into the functions.php file in your active theme directory.
“Also in the search bars, they all say ‘search posts’…”
It’s possible to change that on the Layout Options panel: http://i.imgur.com/bLBi8xK.pngOctober 19, 2016 at 1:56 pm #10524Brett Golding
ParticipantErnest thank you so much for your help.
October 19, 2016 at 2:46 pm #10525Ernest Marcinko
KeymasterYou cannot access this content.
-
This reply was modified 9 years, 7 months ago by
-
AuthorPosts
- The topic ‘A couple questions’ is closed to new replies.