In the last couple of months, I have been working on the website of Stichting Civic. Stichting Civic is a Dutch foundation committed to improving the Dutch civic integration policy for refugees and other newcomers. The foundation aims at 1) collecting and stimulating socio-scientific and legal research into the outcomes of the current policy and 2) providing proposals for better integration policy for newcomers. That policy must be measurably effective, fit within our constitutional state, and benefit both newcomers and society. I’m a member of Civic, and I have been involved since the establishment of the foundation. In other words, I’m a volunteer, and I’m doing all this work because I like Civic and I believe in their goals.
One of the requirements of the website is introducing a new and different content authoring system, different than the native WordPress one. Let me explain briefly what’s and how it’s realized. An author on the website of Civic is a member of the Civic team. The author can be linked to a WP user or not. When a post is published on the website, the creator of the post can assign an author to the post. That author will be displayed on the page of the post. The author is a custom post type created using the amazing Pods Admin. This CPT has a relationship with the native WP Post type, and it’s a bi-directional relationship.
Each author/team member/person has her/his own page on the website. For example, this is the page of Anna Stupers https://stichtingcivic.nl/personen/anna-stupers/ . There you can see some basic information about the author/team member/person and, beneath it, an overview of written posts by that person. Those posts are fetched using the Post Cards element in Avada. Unfortunately, this element and almost all other elements in Avada fetch posts from the database using either categories or tags. That means it’s almost impossible to fetch posts from the database based on a certain value of a custom field in the posts, just like in our case, where we want to fetch all posts written (where the custom field ‘author’ has the ID of the CPT author) by the viewed person.
After a long and exhaustive search online, I came across “Custom Content Pack for Fusion Builder“. I thought it would help solve my problem. However, it didn’t help me, and I got into a refund dispute with the make after all. Before purchasing the plugin, I clearly asked him what I wanted to achieve, and he answered, “Yes, you can.” After all, I wasn’t able to achieve what I wanted. So, I had no other choice than to dig into the code of Avada, Post Cards Element, and make my own version of the element.
I ended up with a working proof-of-concept Post Cards element where you can fetch WP posts by a custom field of your own choice whose value can also be specified. The screenshot below shows clearly what I have added to the element (some words are Dutch). You can see that in the section of Posts By, the drop-down menu has the value of Custom Field. In the section of Custom Field Name, you can fill in the name of the custom field, which is, in my case, “auteur” (Dutch for Author). Below that, you can see the section Custom Field Value. Here, you can specify the value of the custom field. In this case, I’m passing the ID of the currently viewed author/person/team member. So by setting those options correctly, you will end up with a page where you have basic information about the person and all posts written by her/him.
If the person has no posts linked to her/him, then nothing will be displayed in that section which is the case on my page on the website https://stichtingcivic.nl/personen/peshmerge-morad/ (I feel terrible about haven’t published or even helped with a single post/research on the website. I hope this changes soon ^_^). The screenshot below clearly shows what I mean!
Because I was happy with what I had achieved and because I knew many people were looking for such a feature in Avada (I saw a lot of people asking for something similar), I decided to contact the makers of Avada and offer them my edited files. Normally, you would contact the support to offer you help, but this time, I contacted them and offered them something very brilliant :). On the 25th of May, I opened a support ticket on https://theme-fusion.com/support, and I explained my situation to them and what I had achieved and offered them the edited files. Check the two screenshots below:
As you can see in the last two screenshots, the Post Cards Element was not the only element I edited. I have also edited the Blog element as well (check the screenshot below). However, the Post Cards element is what I’m the happiest about!
If you need those files, just contact me or drop a comment below, and I will be more than happy to provide you with the code!
I found out that Avada had implemented what I suggested to them three months earlier. The Post Cards Element in Avada now has natively an option to fetch posts from the database using a custom field. Check the screenshot of the current implementation (very similar to what I have made).
[…] a previous post, I wrote about customizing the Avada Post Cards element to fetch posts from the database based on a […]
Thank you for the post.
Is it possible to have the code that allowed to have the customs field in the “order by”?
Thanks in advance.
Would you please send me a proof by mail to p[dot]morad[at]hotmail[dot]com that you have a valid Avada license? A screenshot is sufficient! I will be more than happy to provide you with the source code!