We have created many pages in Wordpress and want to add an employee (name, phone, email etc.) to every page as responsible contact person. Now we want to add every contact person once in the backend and choose the right person in the page.
We also use Advanced Custom Fields (ACF) and could add a Field for adding the data, but it could be difficult if the employee gets a new phone number for example.
Has anyone an idea how to solve it in wordpress?
My proposition is:
Add custom post type named "Employees" to your WordPress.
Add custom fields (based on ACF) for contact data and assign them to mentioned post type.
Add post object field to your pages and assign employees post type to this field.
And it's done! Now you can assign a specific employee to your page as a post object and display data from it, like this.
Related
I would like to display my custom posts on frontend.
I made a back office for a mobile app, but I'd like to create access from frontend to display information from my back office. First, I try to display single content from a custom post. I need to filter these pages by a custom ACF field equal to my current user.
And I need to check if the user has the good role. I've already configured all my Custom posts, all my ACF fields, and custom roles. I made a specific plugin for my back office.
I would like to create specific shortcodes to display the differents single views and the different lists I'll will need for my back-office..
Custom option
Value
Custom posts name
page_clubs
ACF field related
administrators
Custom role
club_administrators, or club_members
User
Current
So I will preface this with being new to Wordpress/ACF but can do the basics.
I can set up fields and post types and query through them and do loops.
This I am not sure how to do.
I have a post type of properties that each have an assigned contact our of 3 people. I would like to enable to client in the backend when creating a property to be able to choose the assigned contact from a dropdown menu or a set of checkboxes.
That when a visitor clicks on that property the front end displays the contacts name email and phone number which are fields from the contacts bio post type.
I have a relationship field set up to go through the Bios and return the IDs but not sure where to go from there.
Thanks!
Base Fields For Contact Bio
If relation returns selected post's ID you can easy use get_fields($post_id) or get_field($key, $post_id).
I was following this blog post https://www.themelocation.com/how-to-add-custom-fields-to-user-registration-form-in-woocommerce/ to learn about creating custom user fields in Woo (for registration).
The post above worked, and I was able to see new fields during registration, but I had two questions:
How can I get these fields to appear when I'm editing a user in wp-admin? I didn't notice them rendering on the edit user page.
Right now Woo (by default) lets you just register with an e-mail. I wanted to also use a first name and last name (my custom fields), but this is already a field on the users in WordPress, so I don't want to duplicate fields. Is there a way to somehow pull in/use/associate an existing field (such as name) during the Woo registration?
Thanks so much for any help/guidance you all can give me.
1 You can use this plugin for display your custom fields in the admin view.
2 In your template HTML file, find the form, and use the default id & name tag : "Firstname" / "Lastname" ...ext
I have a custom post type called STORIES.
When a user adds a new STORY, I need them to be able to assign a category (or multiple categories) to the post so I can sort them later by category.
To do this, I only want specific categories I assign to the STORY posts to show - NOT all of the wordpress categories attached to every post type.
For example the default Wordpress category is 'Uncategorized'. How do I remove this category (and any othersI don't want) to ONLY show the ones I select via the custom post type editor?
Is there any way I can make this happen?
I am using custom Post Types UI with Advanced Custom Fields.
You can do that with Post Types UI, You will need to create a new taxonomy.
Here is the screenshot explaining that
https://s.w.org/plugins/custom-post-type-ui/screenshot-4.png?r=1180724
Just fill the text boxes with appropriate names, and check STORY under
"Attach to Post Type" option.
After that you will have custom taxonomy like "Story Category" to use for stories only.
i am building a wordpress website for a client. i need to build 1 template type of page with a list of fields that the client can fill in to populate the page. so lets say i build a template page called Person Template. On it i have an empty picture placeholder on the left and an empty Name Field below that. On the right i have an empty "persons phone number" and "Persons email" field.
what i need to create somehow is a system that the client can enter these 4 items into wp-admin somewhere and save that as a new Person. Then they can repeat and save another Person until they have created say 100 Person pages.
How do I do this? I tried building a Custom Post Type called Person CPT. I have built a Page called Person Template. I have built some "Person CPT" posts and put them on a page but i dont know how to create the Entry Fields page for my client to use.
You're correct that you'll need to use a custom post type. To add the fields you have two options:
Add the fields using add_meta_box(). You'll then need to save this data as post meta. Then in your single-person.php template you would retrieve the meta using get_post_meta(). It's a tad cumbersome, as you need to write the markup for the meta box, hook it into an action to add it to the admin page, and verify the content before it's saved. Here's an article that walks you through it
Alternatively get yourself the Advanced Custom Fields plugin: it makes adding additional fields very quick and easy. I use it all the time.