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 called activity_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!
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