0

I would like to list contacts, and I'm unsure how I should do this. Which method should I use "Theme Customization API " or "custom post type"?

My contact page would look like this:

 <h1>Title
 <p>paragraph</p>

 <h1>Title</h1>
 <p>paragraph</p>

 <h1>Title</h1>
 <p>paragraph</p>

 <h1>Title</h1>
 <a>email link</a>

 <h1>Title</h1>
 <p>paragraph</p>
 <div>
    <a><img/></a>
    <a><img/></a>
    <a><img/></a>
 </div>

For title paragraph, I will repeater add another. but for title email link , I will use once, and for title, paragraph, social icons, i will use once, but socials icons i will add 2 or more.

3
  • This is a very vague question and kind of hard to understand what your asking. However, I would take a look at advancedcustomfields.com/pro. If you are trying to create an editable page with repeater content areas, icons, etc. this will definitely do the job. Since this is page specific it doesn't like a good fit to use the Customizer. Also, you should should create a page template. There's not need to create a custom post type. Oct 16, 2015 at 18:53
  • So you want to list contacts on a contact page, but you're not sure if you should have a contacts post type, or if you should put an editable field in the customizer?
    – Tom J Nowell
    Oct 26, 2015 at 14:27
  • I've edited the question to try and make it clearer
    – Tom J Nowell
    Oct 26, 2015 at 14:38

1 Answer 1

1

You have multiple options. there is not single correct way to do this, but some options may be better for you depending on your situation:

1. A page called Contacts

Just create a page, call it contacts, and put your contacts in the page content. Your html is made of paragraphs and header tags, all of which are usable in page content

2. Customizer

You could add a short code that displays a value you saved from the customizer. But this is overcomplicating things, and I would not recommend this

3. Custom Post Types

You could create a contacts post type, which would give you an archive at /contacts that you can display contacts on. Each contacts post would be an individual contact with a header and content/address/etc This would give you a backend interface too, and you can use archive-contacts.php in your theme.

Unless you have more than 9 or 10 contacts, this may be overkill, and you might find creating a page a lot faster/easier

4. User Meta

If your contacts are also WordPress users, you can add fields to the user edit profile page, so that they can fill out their contact details. Add a checkbox indicating if they should be shown on the frontend, and use WP_User_Query to retrieve all the users who set that checkbox and list them. You'll want to implement a shortcode or a page template to put your user query in.

If you do this, you'll need to figure out how to add user fields, how to create shortcodes, and how to do user meta queries with WP_User_Query. This would be the hardest option

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.