Sauter la navigation

[Résolu] I need to add a Favourite functionality using icon font

This support ticket is created Il y a 6 années et 1 mois. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

Ce sujet contient 5 réponses, a 2 voix.

Dernière mise à jour par Waqar Il y a 6 années.

Assisté par: Waqar.

Auteur
Publications
#1163032

Tell us what you are trying to do?
I'm trying to create a Favourite functionality for "Profilo" Custom Post Type. And I'm trying to display the favourite/unfavourite button using and heart icon font from Bootstrap or Font Awesone.

Is there any documentation that you are following?
I'm following this guide:
https://toolset.com/forums/topic/add-post-to-a-favorite-list/

Is there a similar example that we can see?
I think is a standard funcionality in any dating site.

What is the link to your site?
lien caché

So,I have followed the guide, but exactly this reply https://toolset.com/forums/topic/add-post-to-a-favorite-list/#post-459894 :
- I have created a "Favorito" CPT
- I have created two custom fields, the first for User-id and the second for the current Single Profilo post-id, and associated to "Favorito" CPT
- I have created a Form where the two custom fields are hidden but when I press the button take automatically the value about the user id and the current post id.
- I have created a View where the query filter is "Profilo id è rappresentato da un elemento stringa uguale a VIEW_PARAM(postid)" and in the loop I have put the delete post link shortcode, and in no item found the Form Shortcode
- in the template I have put the View shortcode.

When I have do that, all work fine, using ajax. When I have tried to use the Bootstrap or Font Awesome icon font, in the template I cannot see nothing. I have undo every font icon customization but now is displyed nothing...

Why I don't display the favourite button and what should I do to use the icon font instead of the button and the linked text?

I want to use that icon font:
- when the Profilo is favourite this icon: lien caché
- when the Profilo is unfavorite this other: lien caché

#1163069

So, I have solved the Favorite/Unfavorite display issue. The issue was generated by the "what the user display after the action?" in Form setting.

But now, what should I do to display only the icon font instead of the button and linked text?
I do this question because the button in the Form is generated by a shortcode...

#1163217

So, I have found the solution, and now I have other issues:
So, to display the heart I have used the symbol Unicode into the Text value and the relative font-type. I have tried two font type, the first is the Font Awesome and the second is a font of the Divi Theme.
So, I have setted the font size to display the heart as I need. The issues I have is with the cred_delete_post_link messages.
I use that code

[cred_delete_post_link class='cred-refresh-after-delete' text='' redirect="[wpv-post-id id='$current_page']" message_show='0' action='delete' message="" message_after=""]

So I'm trying to not display the deleting message but nothing, it is always displayed. And when I'm using the Font Awesome I see the correct text but I cannot set the message font size and than I display the message text in the same size of heart and it is very big... When I'm using the theme font "etmodules" the message is displayed all in big special character...
So, I prefer to use the "etmodules" font to display the heart, but I need to not display the deleting message.
What should I do to not display the message?

#1163653

Hi Francesco,

Thank you for contacting us and I'll be happy to assist.

Glad you were able to make the Favorite/Unfavorite button work.

Since the "Deleting.." text is added in a translation friendly way, you can remove or customize it, by adding following code snippet in your theme's "functions.php" file:


add_filter( 'gettext', 'change_deleting_text_fn', 99, 3 );
function change_deleting_text_fn( $translated_text, $text, $domain ) {
    if ( is_singular() ) {
        switch ( $translated_text ) {
            case 'Deleting..' :
                $translated_text = __( 'Processing');
                break;
        }
    }
    return $translated_text;
}

Note: if you don't want to show any message while the delete post link is processing, you can replace Processing text from the code.

I hope this helps.

regards,
Waqar

#1164105

Hi, I have tried to customize it with your code but it don't work. Than I have installed the WPML and string plugins to change the translation.
So I need to display a special character with this Unicode: 
But the system in translation don't transform the unicode into the character and display the entire text with the iconfont characters...

#1165459

Hi Francesco,

Thanks for sharing an update.

You can try replacing the Unicode for that special character with the "ASCII" code:
lien caché

In case the issue still persists, please share a link to the page, where that delete post link can be seen.

regards,
Waqar