Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Getting "Favorite" button to work in {descriptionfield}
- This topic has 16 replies, 2 voices, and was last updated 5 years, 6 months ago by
Ernest Marcinko.
-
AuthorPosts
-
November 3, 2020 at 3:00 pm #30124
clopez37
ParticipantGetting “Favorite” button to work in {descriptionfield}. Is it possible?
November 3, 2020 at 4:07 pm #30126Ernest Marcinko
KeymasterHi,
I will need a bit more information on this one. Is this button added by a shortcode? Or is it something else? Can I see it somewhere? Thank you!
November 3, 2020 at 4:28 pm #30128clopez37
ParticipantYes shortcode – [favorite_button post_id=”” site_id=””]
You can check it on this post, as well as the main search on the public home page – https://casebites.com/sales-home (see screenshot):
https://casebites.com/knott-v-state/-Carlos
November 4, 2020 at 11:02 am #30136Ernest Marcinko
KeymasterI’m afraid that is probably not possible. I am seeing some missing attributes on the buttons (missing post IDs etc..), and I suspect that the event handler is not connected either. It was probably meant to work within the single post pages only.
November 4, 2020 at 1:17 pm #30141clopez37
ParticipantDo you think a plugin like this could work instead? https://codeboxr.com/product/cbx-wordpress-bookmark/
November 4, 2020 at 1:46 pm #30143Ernest Marcinko
KeymasterI really don’t think so. Usually these plugins are made to work on the single content pages, and not within custom result containers. I think in almost all cases you will have to do a custom coding to attach the event handlers/styling to the favorite button.
November 6, 2020 at 12:32 am #30158clopez37
ParticipantI’m ok with doing some custom coding, would you be able to point me to the file where the class name “hovered” is being added to the outside single result div?
I think this is possible since I see the right attributes being applied as they are in single post.
November 6, 2020 at 9:33 am #30161Ernest Marcinko
KeymasterSure, it is this one: wp-content/plugins/ajax-search-pro/js/nomin/jquery.ajaxsearchpro.js
However I am not sure I recommend making direct changes to core plugin files, as during an update they are automatically replaced with the originals.November 6, 2020 at 9:57 am #30162clopez37
ParticipantI really appreciate your help Ernest. Are you available to assist with this feature for an hourly cost? I’ve attached two screenshots of how the code looks on both the results section as well as on the single post. If I have to add/edit a snippet of code on every plugin update then I don’t mind if it means getting this feature working. Thanks again for your assistance.
November 6, 2020 at 10:08 am #30165Ernest Marcinko
KeymasterUnfortunately we are not available for custom jobs.
You could make use of the advanced title and content fields, it allows using some variables (like the post ID), to print the button HTML to the results content. From the button source, it should look something like this:
<a class="simplefavorite-button" data-postid="{__id}" data-siteid="1" data-groupid="1" data-favoritecount="1" style="box-shadow:none;-webkit-box-shadow:none;-moz-box-shadow:none;"> Add Favorite <i class="sf-icon-star-empty"></i> </a>However you will still need to add the javascript event handlers in order to make it work, I very highly doubt it will do it automatically.
November 6, 2020 at 10:29 am #30166clopez37
ParticipantThanks, yeah if you refresh, that seems to be working! If you now see below, I am able to favorite on the same page but in the Fresh Bites below. Do you think that link being inside the search result live result is what causing the javascript event handler not to execute?
November 6, 2020 at 10:53 am #30167Ernest Marcinko
KeymasterYes, that is probably the reason.
November 6, 2020 at 3:55 pm #30184clopez37
ParticipantIt’s working on mobile iOS
November 7, 2020 at 3:24 pm #30189Ernest Marcinko
KeymasterThat is great, it means that probably only a minor changes is required somewhere.
November 10, 2020 at 1:58 pm #30237clopez37
ParticipantHi Ernest, I’m still having trouble so I submitted a job with wpkraken.io. A separate question, is there a way to link the categories that appear on the search result to their individual category archive page?
-
AuthorPosts
- You must be logged in to reply to this topic.