Support

Account

Home Forums General Issues ACF Makes Custom Post Types Obsolete?

Solved

ACF Makes Custom Post Types Obsolete?

  • Quick and to the point. I’m using the Genesis Framework, ACF, custom templates, and “pages”. With all of the above, my site seems to work perfectly. I specify rules in ACF to show fields on pages with a certain template, and other specific information. This seems to work 100% perfectly (page design, url structure, etc) for me.

    That being said, I’m nearing completion of my website, and I want to ensure I build it the right way. I feel that ACF makes custom post types obsolete, but I’m not sure. Can anyone explain why I would still want to use them, or confirm that my setup makes them obsolete?

  • I’m not sure I understand your question fully; it’s hard to tell without knowing your site’s needs. But: ACF’s ability to conditionally show fields on different post templates, taxonomies, etc. does make it possible to avoid creating different post types when the default post types and conditionally-shown ACF fields will suffice.

    Custom post types are certainly not obviated by this plugin, however. For example, a website for a running club would have custom post types for race and course in addition to the default post and page post types. An ACF object relationship field on the Race edit page could tie it to a specific course.

    Does that make sense?

  • It makes sense logically, but I don’t get the “why” of it. Let me explain / link my site, to help clear things up.

    The site is on night life / entertainment, and covers every restaurant, bar, hotel, etc, in the local area. In theory, each of those would be a custom post type, if I needed it (or knew why it was advantageous to use them). I’m also not sure how my sub-types would handle (Dining has – restaurants, cafes, delis, street vendors, etc).

    The current custom ACF groups are as follows:

    “Location Info”, which contains a “location_category” field (a check box, used to determine if it’s a bar, restaurant, music venue, or a mix), and a “city” field, used to mark which city the venue belongs to (the site covers various cities in the area).

    “Basic Info”, which contains “description” and “images” fields, which is pretty self-explanatory.

    “Dining_info”, which is tricky. This one, simply determines if the venue has dine in, take out, or delivery, and isn’t specific to the “Dining” section of my website, but instead applies to all templates that occasionally also have food (Bars, Dining, for now, but this is perhaps the one “messy” area at the moment).

    I then have templates for “Main” categories (Music, Dining, Loding, etc), and “Secondary” categories (for music, artists and venues, dining has the sub sections mentioned earlier, etc). The templates aren’t quite done yet (design), but code-wise, dynamically show everything I need based on the ACF information, which works great. I can show events on a calendar dynamically using the page string, which is identical to the “location_category” field. This allows me to query Maps with all venues dynamically, events, and more.

    IMO, I’ve done a very clever job of making this all work, but again, it needs to be future-proof, and I have a nagging in the back of my mind that says custom post types are MEANT to do exactly what I’m doing. That being said, my setup seems to make them obsolete in my situation (based on what I know), and I’m a bit lost. I also really like my url structure (site.com/dining, site.com/dining/restaurants, site.com/dining/restaurants/venue-name), and I’ve heard custom post types don’t play well with custom permalinks. Anyway, sorry for the essay of a post, but I figured I had to explain it as best I could to make proper sense here.

    Ignore the incomplete main and sub category pages – anightinburlington.com

  • In your case, I’d say custom post types are the *philosophically* correct way to go, just because the things you’re using pages for aren’t really ‘pages’. If I were doing it I’d have a ‘venue’ custom post type and an ‘event’ custom post type, and save pages for actual pages on the siteā€”the About, Contact, etc. pages.

    However! If it works for you as is, then stick with it. It doesn’t sound like you’re doing anything too hack-y, and it sounds like the admin interface will still be intuitive, so don’t worry about it and keep it as-is.

  • That’s kind of what I was thinking, but just wanted some confirmation. I think I’ll duplicate the site and toy with custom post types, just to see how it handles, but only in a test environment. If I don’t get them set up and make things feel cleaner within a day or so, I’ll just ditch the effort and stick with what I have, as it definitely works.

    Thanks a lot for taking the time to read my situation, and offer feedback, it’s much appreciated.

  • Here is the reason you need custom post types–not always, but sometimes.

    It’s MUCH easier to display content from custom post types elsewhere on your site (that is, not on the page where you entered the content) than it is to display custom fields elsewhere.

    I discovered this the hard way: I set up a repeater field group for “Careers” information. The field names were “job title”, “job description”, and “info link.”

    Displaying three sets of these on the original page–no problem. I followed the instructions for looping through repeater fields and it worked fine.

    But I wanted to be able to display JUST the custom field content elsewhere on the site. After EXTENSIVE trial and error (I’m not that great a developer), I was able to create a page template that looped through all the posts that had career fields and displayed just the field info.

    The problem was that I wanted to sort by job title, not by post, and there were three careers per post. It may be possible to do this with ACF, but according to my Real Developer husband, it would be hugely resource-intensive to do so.

    So instead, I created a Career custom post type with ONE custom field (for the info link) and PRESTO! It was extremely easy to create an archive page for Careers that listed careers alphabetically. It was also easy to create a post page template to show 3 career entries with the same taxonomy as the post. AND I can easily display careers in widgets. (It’s a Genesis theme.)

    So that’s really why you need custom post types (which may have ACF fields in them): when you have to be able to display the content in different ways in many places in your theme.

    For me, at least, rolling a custom post type and taxonomy is a heck of a lot easier than working out ways to display fields, too. WordPress just doesn’t support field retrieval in the same ways as post content retrieval. ACF helps make it easier, but is still limited by the fact that all your ACF data goes into the post_meta table.

  • Thanks for the follow-up posts. I’ve decided to use Custom Post Types primarily to organize the massive amount of content I have. I’ll eventually have over 50 restaurants, 20 hotels, 20 bars, etc, and having them all under “pages” was going to be a mess. I’m now looking into creating a few custom post types (for each primary subject the site covers), with some custom taxonomies for sorting what would be their sub-categories (think Lodging CPT, with a custom taxonomy of “type” with hotel, B&B, resort, etc).

    The only thing I’m a bit hung up on right now is the url structure I want. I know I want a main HUB for each topic, such as Dining, Lodging, Music, etc, and I want a sub-HUB for each of the “type” taxonmies (hotels, B&B, resorts, etc), but I can’t decide if the sub-HUB should be included in the URL, like so:

    site.com/lodging/resorts/resort-name

    OR

    site.com/lodging/resort-name

    The former has logical structure, breadcrumbs would work great, etc, where as the latter is a bit future-proof (if I change taxonomies, or restructure my data in any way). I can still have the sub-HUB pages to showcase all related content, but then have the actual content not include the taxonomy type in the url.

    Anyone have any advice on this?

  • You might consider parent and child post types (see http://justintadlock.com/archives/2013/10/07/post-relationships-parent-to-child for a bit about this). You can see examples of this kind of thing in the Sensei learning management plugin, which has a Course post type with other post types as children: lessons, quizzes, etc. You’ll probably want to explore different possibilities.

    I would not worry too much about the URL structure–just don’t alter it to the point that WordPress gets confused. If you make major changes to the site you will end up needing to create 301 redirects anyway, and you can use regular expressions to make your life easier there.

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘ACF Makes Custom Post Types Obsolete?’ is closed to new replies.