Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

My goal is to give end users on my projects the maximum amount of control without making them work with any code.

I've been using Advanced Custom Fields ("ACF") along with the Repeater Field add-on for some time now with great results, but I'm torn between two setups.

The problem: A site needs to list employees on a page. They will not and should not be visible anywhere else.

Old way: In the past I would setup a CPT for employees, plug in a quick WP_Query on that page template and be done with it. Then I added ACF and the Repeater Field add-on to my workflow. The new workflow allows me to setup a repeatable field where the admin can select a post object from a dropdown (filterable by post type). Admins can select the employee CPT object and keep adding or removing these as needed with the Repeater Field. They can even drag and drop the fields to reorder them.

Problem with the old setup: The drawbacks I found to this approach are the repercussions of creating a CPT: mainly that the CPT is individually visible should a visitor stumble upon its URL and can be indexed by search engines. Template redirects and robots.txt can solve these issues but I wonder if there is a more efficient way...

The alternative: Why not setup the repeatable fields directly on the page that's meant to display the employee data and include ACF fields I would normally include in the employee custom post type like name, image, bio, etc.?

To me, this is a far cleaner and more efficient solution. This way, admins don't need to create a CPT and then go to the employees page and add the CPT they just added to the repeatable field that's setup there; they just input the employee data directly on the page where it's meant to be displayed. No template redirects or robots.txt tweaks necessary and they edit everything from within one window.

I realize this solution may only be workable in a scenario where these faux CPTs only need to display on one particular page.

Can anyone make a good case for or against a setup like this?

share|improve this question
    
I don't understand why you need this Repeater Field part. If you have a CPT 'emloyees' and a custom page template that lists the posts of your CPT, what else do you need? –  Christoph Feb 28 at 11:09
    
The Repeater Field is a tool that mostly benefits clients. It enables them complete control of the order that fields display in with add/remove and drag-and-drop capability. Just using a CPT and a page of posts limits you to either WP_Query() or get_posts() and the sorting criteria available to them. Your client may want manual control and the ability to include/exclude on an ad hoc basis. –  cfx Feb 28 at 15:42
    
A list of employees is a common part in my web projects. I prefer to have a custom post type because in my opinion it's a more reliable and wordpressish way to manage the data. You can't tell generally which approach is best. You have to look at the requirements, for example the number of employees. I created a website that lists 550 employees. It wouldn't be very convenient to manually sort 550 custom field groups on a page. Moreover there is a number of people that need to edit employees. If they all need permissions to edit the same page, a mess is bound to occur. –  Christoph Mar 2 at 12:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.