Accueil › Toolset Professional Support › [Résolu] How to create a list to display the last 5 CPT posts created
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 |
---|---|---|---|---|---|---|
- | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | - |
- | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | - |
Supporter timezone: Europe/London (GMT+00:00)
Marqué : Content Templates, Views, Views plugin, WordPress Archives
Documentation connexe :
Ce sujet contient 45 réponses, a 2 voix.
Dernière mise à jour par Nigel Il y a 5 années et 9 mois.
Assisté par: Nigel.
Hi Nigel,
thanks for your reply.
So, about the Favourite system I have followed this metod https://toolset.com/forums/topic/add-post-to-a-favorite-list/#post-459894
Yes, I need to have the ID from the current item in the View loop.
But, if it is not possibile to add single Profile item to Favoriti without the page who content the View is reloaded everytime when I click on the heart icon, I think that I delete it from the View that dispaly the Profile list, and I will insert it if the Dev work on the Toolset plugin to implement it with dynamic system (I think ajax, same the facebook notification) that have the creation af the Favorite posts without reload the page where the View is added. But I Allow it into the Profile posts.
So, what I need to use to replace the "id="$current-page"" to assign the ID from the current item?
About the location system, all is setted by Christian Cox, I think I need to ask him what should I do to display the correct location.
Les langues: Anglais (English ) Espagnol (Español )
Fuseau horaire: Europe/London (GMT+00:00)
Unless I have misunderstood, you do not need the id="$current-page" attribute at all.
If you don't include it, then the post that the shortcodes refer to will be the current post.
On the profile page, the current post is the profile post.
In the output of the View, the current post is the current profile being looped over by the View.
Try it and see if anything breaks.
Hi Nigel,
So, I have duplicated all "favorito" Form, View and Content Template, I have deleted the id="$current-page" attribute, and now something work.
But, is difficult to set the redirection, because everytime I click on the heart icon the page is reloaded, and some Form settings on page reload open the profile post without create the Favoriti post, with or without ajax...
Or if in Form is it setted to show a message, on clicking heart the page is reloaded and the message is show in the next items, and the heart of the items where I click it become what I need, and the Favoriti post is created.
But when I click on the new heart icon to delete the post from the Favoriti CPT, on reload, it open the Profile post.
It was beautiful if when I click on the heart the system do what I need without reload the page. Tis also in the Profile posts...
Les langues: Anglais (English ) Espagnol (Español )
Fuseau horaire: Europe/London (GMT+00:00)
Hi Francesco
I think I will need to take a copy of your site so that I can test it locally, to verify for myself what works where. Is that okay?
Before I do, though, I would repeat the advice I have given before to users trying to use Toolset Forms to create a favouriting or similar functionality: don't.
It is possible, but with some unavoidable side effects, such a the unwanted URL parameters, but it is not what the forms are designed to do.
"Favorites" is an excellent plugin that would be a much better solution, and which would work on the profile page directly, and when the profiles are displayed in a View. I suggest you take a look and decide if you want to proceed trying to implement this with Toolset Forms, or whether a dedicated plugin wouldn't be a better option.
lien caché
So, it was beautiful if Toolset permit to do that, Because Toolset is a good plugin that more function, but it don't work well in more his features.
So, for example, in a site with an items slider, I have used the standard toolset features for display a carousel. Toolset permit carousel only with pagination, and with this feature applied, the site was very slow.
So, I have optimized a new jquery carousel like the carousel in this page incontramici.inonda.tv/test/ and the site speed up...
So, if there is a not good solution, I'm trying to use the "Favorites" plugin.
If you need to have a clone of my site, to improve the features you can do it.
Les langues: Anglais (English ) Espagnol (Español )
Fuseau horaire: Europe/London (GMT+00:00)
Hi Francesco
I can't really comment on the performance of the slider without knowing more details, so let's stick to the issue of the like/favourite button.
Toolset is a general-purpose suite of tools, and much like a carpenter can do anything with a good set of basic tools, there will times when a better result can be achieved with something that is more specialised for a particular task.
Toolset Forms can be used to get a like-functionality working, but the solution is somewhat contrived and it is not the kind of thing that the original developers had in mind for it. I have got it working in the past, and I can get it working for you, too, but my honest opinion is that it is the wrong tool for this job given that there are freely-available purpose-built tools you could use instead.
So I'll wait to hear from you about what you want me to do. If you would like to get it working with Toolset I'll take a copy of your site and work on it, bearing in mind that I cannot overcome some problems such as the URL parameters.
If you want to experiment with the favorites plugin then go ahead and let me know how it works out.
Hi, I have installed the "Favorites" plugin, and added the shortcode in the items into the test page lien caché
Now appear the favorite button but if I press on it don't do nothing...
So, if the favourite functions built with toolset can works like as the Favourite plugin, I prefer to use Toolset.
If it cannot have the same workflow, than I use the Favorites plugin, if it work.
Than, about the same logic, to have a instant messaging service I use a third party plugin, but I would to built the messaging service using Toolset, following this guide: https://toolset.com/learn/how-to-create-a-messaging-system-with-toolset/
So, to build the messaging service I will have the same problems about the favorites service?
Because if it is yes, I don't build it with toolset...
Other questions:
1 - So, in some pages I need to display a list of the Profile post about the users that have a specific Role, or order the Profile posts putting on top of the list the Profile posts about the users that have a specific Role.
2 - when a user create his own profile post, he set his preference about genre with two specific Taxonomies, first called "Sono" (in english "I am") with two value "Man" and "Woman", the second called "Cerco" (in english "I search") also with two value "Man" and "Woman" too.
So, if it set that the I search in "woman", when he navigate in all site pages, and in all profile posts lists, the items displayed should be the profile post that have the "I am" value at the same "I search" value setted in the profile post of the current logged in user.
It is possible to do that with query filter or using some custom codes?
3 - About the custom code in the your first reply in this ticket (https://toolset.com/forums/topic/how-to-create-a-list-to-display-the-last-5-cpt-posts-created/#post-1189646), if I want to use the same code with other View, it need to create a new custom code, cloning the code, change the function name, change the View id, or it is possible to add other View id in this custom code?
Les nouveaux fils créés par Nigel et associés à celui-ci sont repris ci-dessous :
https://toolset.com/fr/forums/topic/split-list-profile-posts-of-users-with-particular-role/
https://toolset.com/fr/forums/topic/split-matching-looking-for-and-i-am-taxonomies/
https://toolset.com/fr/forums/topic/split-re-using-custom-code/
Les langues: Anglais (English ) Espagnol (Español )
Fuseau horaire: Europe/London (GMT+00:00)
I split off your other questions into separate threads, I'll try and resolve the problem with the favourite functionality here.
I'm setting up a fresh test site locally where I can get this working myself, and then I'll report what is required.
Les langues: Anglais (English ) Espagnol (Español )
Fuseau horaire: Europe/London (GMT+00:00)
Taking another look at your site (it takes some time to understand because of the nesting and duplication of templates and Views) it seems to be working now. On the View which displays the favourite button when showing a list of profiles (I don't understand why you need a different View than the one that does the same on the profile page) the redirect for the cred delete link was missing the current_page id attribute.
Adding that I can favourite and un-favourite profiles from the list of profiles.
I'll look at your other issues soon, but I think this particular issue is resolved.
Hi Nigel,
thank for the replies.
So, in the View, I have setted to not reload the page, on click on the heart icons, and to show a text message to confirm the addition to favorite as the ajax mode.
So, if I click on the heart icon (see the attached image 01.png), the page is reloaded and the heart icon change as the profile post is added to favorite, but the text message that it should have appeared in place of the heart icon about the profile post item where I have clicked the heart, it appear in the next profile post item in place of the heart (see the attached image 02.png).
So, I don't know why the page is reloaded, and why it append.
I think that is useful to use the favorite plugin if this problem cannot be resolved and if on any click on heart button the page is reloaded.
Les langues: Anglais (English ) Espagnol (Español )
Fuseau horaire: Europe/London (GMT+00:00)
If you use the form settings with an ajax form to display a message after submitting the form, it still refreshes the page so that the message can be displayed, and adds a number of URL parameters to the current URL.
The only way for the page not to reload, and add such parameters, is if you choose the setting "Keep displaying the form".
You could then borrow from "Optimistic UI" and simply change the icon to a message yourself using JavaScript and an onclick event.
So a user clicks the heart icon, submitting a form to create the favourite post, and a little custom jQuery is triggered with the submit to swap the icon for text.
(By the way, I couldn't look at the backend of your site again because the password has expired, although I'm not sure that I need to.)
Sorry for my delay in reply, but I have little time this period.
I will test all solution in the weekend!!!
Les langues: Anglais (English ) Espagnol (Español )
Fuseau horaire: Europe/London (GMT+00:00)
No problem, let me mark this as awaiting your feedback so it's not sitting in my queue.
Hi Nigel,
Sorry for the delay in this topic.
I have installed the "favorites" plugin, and I have used it in the layout instead to use favorites CPT and Favorites CRED.
So, it works as I need, without reloading the page...
Now I'm trying to create a favorites list about the profile posts that I have added, and also a list with the profile about the users who have added me (the current user profile post) in them favorites list.