Hmm, perhaps I am approaching this from the wrong angle then.
Remember those categories I mentioned? They have their own page on a site, about the category. And I gave an example of 5 but there’s really like a couple of dozen categories, with a page for each one.
The way the current website is set up is that the testimonials are manually entered for each page. My thought was that, in a redesign, I could set up a Testimonials custom post type, give each a category, and then just use a page template in conjunction with ACF that would have a section at the bottom saying, “Pull in the testimonials that were selected on this page.” It also would be future-proof, in a way, if I had it set up to display the most recent 3, too; people wouldn’t have to manually go into the page and edit it as they do now.
But if I have to create a taxonomy template for each of the dozen categories, and then additionally possibly change the URL structuring for them to get pulled in and display properly, that might not be worth all the effort.
It’s also possible I’m just not following the suggestion, but my thoughts had originally been that I could simply edit a page template — even if it was THE page.php template, with a “if testimonials exist, display them from the selected category here” setup (with subsequent styling). But if making a several dozen templates to correspond to each selection is necessary to proceed, I don’t know if that’s the route to go for efficiency.
The first part of what you said helped out a lot. I was able to set up a Field Group so that a dropdown appeared on a new Page and one of the Testimonial categories would be able to be selected.
I’m a bit confused on the second part, however. I had created a new page template (and used it in my test page) so I could tinker with the correct syntax, but I can’t get it to appear. I’d think the syntax would be something like “if a testimonial category is chosen (ie not blank), display it” but it’s not really working out. I also tried using the Basic Display (single value) example syntax from https://www.advancedcustomfields.com/resources/taxonomy/ (even changing the ‘taxonomy field name’ to what I used in my field group), but nothing displays inside the H2 or p, so I know I’m doing something wrong.
Let’s say my Testimonials custom post type has the following categories: Yardwork, Driveways, Windows, Doors, and Roofs. If I was trying to write the code block in a page template, what would the syntax for such a thing be?
Or, if I’m making a template (using a slug as you say), can you give me an example of the code block syntax that would go in the template file as you referred to it?
Going to jump in here again and ask how I can make that employee archive post in a set order… I added three employees, but they display in different positions/order than they should. I manually edited the Order field (1, 2, 3) for each entry, but to no avail.
EDIT: Found this and it worked!
Yep, that definitely worked (both of them)!
Last question then that I’ll ask before closing this out is how I’d make the archive page be two columns, such that it would generate/display content like so:
I started messing around with it to try to get that but it seems to just list them one after the other in a single column or, if I try to code in a second column, it just repeats the data in that one.
Thanks, that worked for getting the archive to display. I played around with it and got the single employee page to work just fine. However, the overall page that lists all employees, it’s not bad, in that it’s listing the employees one after the other on their own line, single-column. I can click their name to go their single page, and that one seems fine if i just style it (the get_field query is working just fine) but, for the overall employees list page, I’d like its presentation to be two-column, with each employee’s title under their name (title not linked, just their name is linked). I tried this with this syntax:
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <?php get_field('employee_title'); ?>
The archive page is ignoring the get_field and still just displaying only the permalink. Do you know what’s going on there? I figure if I can get the title to display under an employee name, well then I can style it to be two-column thereafter. I’ve attached the archive file for reference.
Thanks again for your efforts thus far.
EDIT: Also, while I’m waiting for a reply, I’m noticing some of the employees I’m adding here don’t have a URL for LinkedIn. On their single pages, since it’s a template, it’s still generating a hyperlink, but it’s not pointing to anywhere. Is there a syntax I can toss into the single page archive that says something like “if (field) is blank, don’t display this section?”
This looks like an interesting way of handling this. I’m not sure what’s going on with the archives, though. I’m getting a Page Not Found when I go to what should be the archive page (per your post above), though. I checked my functions.php and see that archive is set to true for my employee post type, and I also added the rewrite slug code you linked to, so I’m not sure what the deal is there. Any ideas?
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!