Powered by LUIT.nl - Constant beta
peterluit_vrijstaand

Advanced Custom Fields versus Pods in combination with Beaver Themer

Advanced Custom Fields versus Pods in combination with Beaver Themer

Without explaining all in-depth details of both plug-ins, there are some major differences in combination with Beaver Themer. Hopefully this blogpost helps in deciding which way you would like to go.

• Warning: this a so-called ‘long-read’ 😉
• Content on both test websites totally random
• Used Pods beta version 2.7.0-b-1 for this comparison because of its new extended bidirectional relational capacities
• Follow the discussion on the subject on the Beaver Builder Facebook group

Both plug-ins are very popular for various kind of database publishing within the WordPress CMS. ACF is ‘just’ about creating fields and has the most extended set of fieldtypes in the market. Pods offers the creation of both Custom Post Types, fields as well as a powerful (HTML like) editor for making layouts (which we will not use/need in this test, we do use Themer for creating the templates). Pods competes (functional) with Toolset (the combination of Types and Views). If you use ACF, you need to grab some tool for creating the CPT. In combination with Themer, ACF integrated in a basic way for making both archive and single (custom) post types templates.


Basic explanation of the Pods connections with Themer

How to start with Pods

Enable Archive Page and define slug for CPT

Creating the CPT is just a couple of easy steps in Pods. If you used Custom Post Type UI before Pods to create your CPT, you’ll notice the straighforward set of options to create the CPT in Pods. We will not cover all the settings in detail here, since there are numerous resources, which cover the basics of creating a CPT in Pods.

If you want to create an archive and a single custom post type template using Pods in combination with Beaver Themer, you have to do two things:

  • First install the small ‘connection’ plug-in ‘Pods Beaver Themer‘ from GitHub. That plug-in gives you accees to all the Pods fields through the Beaver Themer interface in various modules. Update: the plugin will be in the WordPress repository in a couple of weeks.
  • Second (for creating the archive template in Beaver Themer), be sure to set ‘Enable Archive Page’ in the Advanced Options for the CPT (see screenshot). That is the equivalent for ‘has_archive’ => true, if you defined the CPT in ‘any other way’. I wonder why this option is not ‘on’ by default. Update: Pods noticed this remark and they will change this in the upcoming 2.7 release.

You could also define the requested slug you want for your archive page. In our example we choose the slug ‘books’, because our CPT is about books.

You can easily change all CPT variables with Pods. However if you change the CPT basename, after you already connected the CPT with a Themer template, you have to re-connect the new name again in Themer. It does not automatically recognize the changed name.

Themer integration

Themer automatically connects with various field creating tools, either with a user interface or via code. The little Pods ‘connection plug-in‘ does that job even a bit better than the ACF user interface. In ACF you need to remember the fieldnames you use in ACF to use the right field in both your archive and single custom post type page. The Pods integration knows the field names and gives you a pull-down menu to choose from. We asked Justin Busa from Beaver Builder to change that approach, since it delays the workflow to go back and forth every time to get the right fieldname.

Relationships in the back-end

As we explained before relational database publishing is a very powerful way to display content from various ‘sources’ on one page. In our example we would like an author page, where we display all books from that author, based on the ‘per post’ title connected to that author in the ‘books’ records. In the screenshot below you can see that approach offered by the new Pods version 2.7, with its renewed relational approach.

You have to set up the relational field in a specific way to get the list view above and being able to create new books for that author. See the following to screenshots below.

In the CPT ‘authors’ you need to define the relationship field ‘books’. Books are created in the CPT books and there they get the author assigned to that book. To get the list view with all possibilities shown above, select ‘Aditional Field Options’, and then choose ‘Multiple Select’ as Selection Type and ‘List View’ to Format the output in the back-end.

The record (as we call this in database/table terms) with the name ‘Peter Luit’ shows the relational records from the CPT ‘books’ in a nice list form (see below). Every single book can be edited in a separate ‘pop-up’ window, viewed or deselected from the list. With the ‘Add New’ button a new book could be added for that author, without going to the CPT ‘books’. That speeds up the workflow!

In database term the displayed books above are part of the books records in the CPT ‘books’. So the listed books are not part of the author record, they are just there because of the relation, in ‘real bits and bytes’ they are ‘just’ in books. FileMaker Pro developers migth remember this view as a ‘portal’ (a port to look through to see records from another database table).

The example above show the ‘reverse’ relation: a book with the authors who contributed to the book

Relationships in the front-end

So, we want a single ‘author’ page, which displays all book by that author. And we want a ‘book’ page, which show the authors who have controbuted to that book. That said, that means that an author could contribute to many books, but that one specific book could have just a limited amount of authors, with a minimum of one.

The Posts module has been extended with a Pods tab to get the related field in the content area with the Posts module. For both the authors archive and the books archive, we use the Posts module in the normal way. There is no relation involved on bot archive pages, content on these pages are the ‘direct’ records.

On the single book page we want to see the author(s) who contributed to the book and on the single author page we want to see the book(s) they have contributed to. For those we need to set the relational field in the Posts Setting tab for Pods.

On websitesvanoranje you can see the very basic results of this bidirectional relationship test with Pods and Beaver Themer.

More details with some more fields to display has been done by Berhard Gronau

Doing ‘it’ the ACF way

First of all, ACF is a great product and offers a very nice back-end to create a very impressive collection of field types. Their user-interface feels so much better compared to Pods. But in the relational aspects ACF seems more confusing. There are three basic types of what they collected under ‘relational’. Here we ‘skip’ the taxonomy and the user relationship, since these are not needed for our book/author test.

  • Post Object
  • Page Link
  • Relationship

At first this is a bit confusing, since the explanations given at the ACF website for sure do not give a 100% clarity about the diffenrences between the three:

  • The post object field creates a select field where the choices are your pages + posts + custom post types. This field is useful for advanced linking to another page / post.
  • The Page link field allows the selection of 1 or more posts, pages or custom post types. This field is useful for easily linking to another post because it will return the post’s url (permalink). To get more data from the selected post, please use the post object field.
  • The Relationship field creates a very attractive version of the post object field. With a Relationship field, you can select from pages + posts + custom post types. This field is useful for advanced linking to another page / post object.

There is a seperate section about bidirectional relationships. If you follow that link, you can get an impression how complex bidirectional ‘must be’ in ACF. For our little test we just took the ‘normal’ relationship field to make the connection between the books and authors CPT’s.

  • books_of_author in the group Authors links to the CPT ‘books’
  • author in the group Books links to the CPT ‘authors’

Since there is no special add-on for the connection between ACF and Beaver Themer, there is no such thing as an extra ACF tab in the Posts module to get an ‘autmatic’ relationship to display the related content. Therefore you have to code a little to get things done.

As with Pods in the two archive templates in Beaver Themer nothing special will have to be done to display either the books CPT archive or the authors CPT archive. In both single CPT Themer templates, we want to dispaly the related content. On a single book CPT post page, we want the author(s) who contributed to the book and on a single author CPT post page, we want the book(s) written by a specific author.

No native support for relationship field

For as far as we could test, we did not find the direct possible use of the ‘relationship’ field in the Themer ‘fieldtype selector’. Therefore we had to use the Custom Content Shortcode plug-in to get things done. Ofcourse it would also be possible to write your own shortcode, but that requires some PHP knowledge. In the screeshot above, we used the HTML module to inset the following code:

<b>Auteur(s):</b><br/>
[related auteur]
[field link=url_auteur]
<a href="[field link='url_auteur']">[field naam_auteur]</a><br/>
[/related]

The <a href…. line was the most challenging. It seems (don’t know for sure) that the WordPress core does not accept a shortcode anymore with the <a href…. call to another location. the link supplied by the fiewld ‘url_auteur’ did not work and then the URL in the link seems to be the URL of the page where you are on, so not the link to the author. On the Beaver Builder Facebookgroup there was a long list of suggestions, all of them did not work until now.

See zeesluisvelsenaanzee for the basic views of archive and single post pages.

In the screenshot above, you can see that the ‘relation’ gets the URL from the author and it also displays the link to ‘Peter Luit’, but the link intself does not work. And in fact that ended the test for using ACF in a relational situation with two CPT’s books and authors. Any suggestion to get this to work with ACF is more than welcome. Keep in mind that Themer is just in its first release, we are sure that in one of the next version the integration with any of the major field tools in the market, will be improved.

6 Comments

  1. Craig on June 6, 2017 at 03:49

    Good breakdown of the key differences between ACF & PODS!

    I’ve gone all in with PODS.
    – CPT and Custom Taxonomy creation is easy and quick.
    – PODS templates with Beaver Themer. The IF and EACH conditionals in my templates give provide great flexibility on what gets displayed.
    – Magic Tags are fun and easy to use.
    – Relationships are easy to implement
    – Bi-directional adding of relationship content on the fly (upcoming 2.7 release) will dramatically speed up workflow
    – Strong Slack channel support (the forum is well maintained too, but I’ve been preferring Slack lately)

    • Peter Luit on June 6, 2017 at 07:28

      Thanks Graig for your Pods wrap-up. I totally agree with you.

      Kind Regards,
      Peter

  2. fizgig on June 28, 2017 at 23:30

    Is there a way to create a relationship between a CPT, and a Taxonomy from another CPT (using BB)?
    Example…

    CPT 1 = Artwork
    Taxonomies = “Artists” and “Artwork Country”

    CPT 2 = Artist Bio
    No Taxonomies

    I want to display the taxonomy “Artists” within a CTP “Artist Bio” post. (This would basically display an archive of all the artwork for that specific artist on the corresponding artists bio).

    I’ve attempted to do this, but I see within the BB posts module the query settings reads… “Field from Current Post Type”…hover over the little info ? and the tooltip reads “Only fields that connect to a Custom Post Type will work”.

    This confuses me because within the Pods relationship settings there are options to connect to taxonomies, post types, and other WP Objects.

    I could just set it up to connect each CPT. (Artwork to Artist Bio)… then use the Multiple-select field within Pods Relationships…but the problem here is if I add more “Artwork” for that specific Artist in the future…it will not “auto-update”… I would have to go into every single Artist Bio and manually select the new artwork to display it on the Artists Bio Page.

    Am I missing something here?

  3. Bernhard on June 29, 2017 at 09:14

    Did you try it? What did not work for you? Will take a look but generally speaking:
    First setup an working data structure and then think about and test the Data Output!
    There are plenty of options besides a posts module – like the pods widgets, I will take a look and test the posts module because I think the help text might be a bit to limited!

    Why not put the Artist bio into the Taxonomy? or link Artists – Artwork directly? there are reasons for doing neither of it then this could be one of the rare cases where a full relationship between tax – cpt would make sense!

    and at you last paragraph no that’s wrong if you e.g configure the relationship as bidirectional then you see the entries on both sides … and even without the use of bidirectional you could utilize the connection from both sides – just more complex by using pods and the WHERE parameter – https://pods.io/docs/learn/shortcodes/pods/

    I hope that helps a bit with your pods journey – you are reaching into a bit more advanced techniques and there is as with every tool a learning curve.

    Have a nice day!
    Bernhard

    • Peter Luit on June 29, 2017 at 09:36

      Thanks Bernhard for giving this reply to @fizgig. I learned something new as well 😉 #WHERE

  4. Dan on November 2, 2017 at 16:23

    I just got a bug surprise by Pods.
    I accidently deleted one “Pod”.
    Then I was hoping to get it back from “trash” only to find that there is no trash option for pods.
    Then I recreated that post type with pods, the posts are no there, but under that post type category, it says a post is attached to it.

    What a mess.

Leave a Comment