Context
In a previous post, I wrote about customizing the Avada Post Cards element to fetch posts from the database based on a custom field value. It’s good to mention it once more that this feature was added to Avada later on, and it’s now shipped by default in all new versions of Avada starting from June 2022
I made something similar this time because I needed it, and it was not included in Avada. I’m using Avada in combination with Admin Pods, where I have a custom post type (CPT). This CPT has a custom field calledactivity_date
, and on the front-end (archive layout) for this CPT, I need to order those CPTs based on the value of the custom field. Unfortunately, within the Post Cards element in Avada, you can only order the fetched (custom) posts by one of the following attributes: date,title,name,author,id,comment_count,modified,rand,price,popularity,rating,event_date
. Check the screenshot below; the default value is to order by Date
.
Solution
To solve this problem, I had to edit the file fusion-post-cards.php
in /wp-content/plugins/fusion-builder/shortcodes/fusion-post-cards.php
. The adjustments I have made in the file enable anyone who uses the Avada Pos Cards element to order fetched posts by a custom field in the (custom) posts.Β Check the screenshot below:
As you can see on the screenshot, I have entered the custom field activity_date
in the field Custom Field Name
. Then I had to specify the Custom field type
this is very important to be selected correctly. In my case, since the custom field is a date field, I had to select Date
. Make sure to choose a type according to the content of the custom field. The default value is String
. To read more about the types in WordPress, please visit the Developer Resources of WordPress via this link.
Again, I will reach out to the Avada support team and ask them to incorporate my change in Avada!
Update 18/07/2023
Avada incorporated my code changes into their code base. If you check the Avada changelog, you’ll see that Version 7.11 – June 19th, 2023Β included this new feature:
- NEW: Added option to order Post Cards by custom sorting order and by custom field
. This means you don’t need my file changes anymore since it’s already there from version 7.11.
Hi Peshmerge β I just stumbled on your blog, and I’m loving it. I’m a longtime user of Avada and a big enough proponent of the theme that I put as many clients on it as I can. That said, you have plenty of interesting content beyond Avada too β really awesome stuff.
In this specific case, I’m wondering if you could help me with the following:
– Do you ever share the code modifications you made, or do you leave that to the reader and use this blog merely to let people know it’s possible (and the template to account for)?
– As far as I know, you can’t create a child theme override for the fusion-post-cards.php file, correct? So, at present, are you just reincorporating your adjustments with every new theme update that Avada pushes out?
Thanks man!
β Jay
Hi Jay,
Thanks for your kind words!
I would like to share the code with everyone because I believe many people out there need what I have achieved. However, considering the commercial nature of Avada and the license, I can’t share the code here or on GitHub!
I have contacted Avada support, offered them my modification, and asked if they want to incorporate it in the upcoming release(s)! They were very welcoming but didn’t give a specific date for that!
And indeed, since you can’t override the file, I copy and paste the modification after each update π I know it’s not a sustainable solution, but I have no choice!
If you want this specific feature, I’ll be more than happy to share the code with you, but I need some kind of proof (screenshot or whatsoever) that you have a valid Avada license to avoid any problems with Avada due to sharing their code with others!
Cheers,
Peshmerge
Thanks Peshmerge!
I’d be happy to provide proof by email, or by whatever means you’d prefer β when convenient, just let me know how you’d like to go about it π
(and thanks!)
Hi Jay,
Just hit me at p{dot}morad{at}hotmail{dot}com
Cheers π
I’ve been looking for this for months and have tried countless times to come up with working code myself to accomplish this. Please make this code available, it’s the one thing missing in Avada!
Hi Jelle,
Thanks for your comment! Please email proof you have a valid license, and I will be more than happy to send you the modifications!
Cheers,
Peshmerge
Hey, could you please send me the source code for this? This is an absolute life-saver.
Hey Sam,
Sure π
Cheers,
Peshmerge
I would be very interested in the source code as well since it’s a major problem for me right now. Thank you in advance
Hi Bosco, no problem!
Please send me by email a proof that you have a valid license for Avada, and I will be happy to send you the code!
Cheers,
Peshmerge
Dear Peshmerge, I found your post on the web and would be awesome if you could share this code with me.
This feature I think is a must have and I hope that Avada team will add it asap.
Regards Marco
Hi Marco,
Thanks for your comment!
I will be happy to share it with you! I kindly ask you to provide evidence of a valid Avada license per email! Once I receive it, I send you the file!
And yeah, I will contact Avada support again and ask them to incorporate my code modifications in their code base!
Cheers,
Peshmerge
Hi there! I just sent you an email about getting a copy of the code to implement this, thanks!
Hi Cam,
I will do!
Is it possible to select a post status for the post cards as well? I’d like to create a carousel that only features scheduled posts to give users a “Coming Soon” banner at the top
Hi Chris, can you elaborate a bit more? What exactly do you want to do?
i wish they would implement some sort of new post badge with conditional data like only apply it on posts the are 10 days old or younger…. do you know of anything that does that ?
Hi Danny,
It’s not that difficult. It depends on what you have? Do you mean doing that when fetching WP Posts? or CPTs? Can you provide more context/details?