I am using wordpress for my new website and i have list of clients(name and their logos). I am confused how to make those editable using wordpress? Html as follows…
<ul>
<li><img src="1.jpg" alt="client1"/>Client1</li>
<li><img src="2.jpg" alt="client2"/>Client2</li>
</ul>
Should i use custom post type or something? Please suggest some similar examples or better approach to achieve this using wordpress, so clients can be added/edited/delted easily.
thanks.
You’ll want to use a custom post type for this. But don’t let the terms “custom post type” scare you off.
For example, one of my clients needed to present a “line card” displaying their various partners. All they wanted, originally, was the name and logo of their various partners. After I built out the feature, they wanted to add a description for each partner.
The custom post type ended up including a Title, Editor, and Thumbnail. The end user can create a new “partner” and enter the content in a traditional WordPress post edit screen – no need to edit code anywhere.
Their line card page is then rendered using a custom shortcode that displays all of their partners in an easy-to-read format.
The Code
Adding a custom post type is fairly straight forward. Just define what you want to call it and set up your strings appropriately:
Then it’s a matter of describing and defining your output. The
[linecard]
shortcode example below is what does all the work to pull this info out of the database and render it on screen:In Addition
Once you have the content loaded into the database, you can pull it out however you want. In addition to the line card, my client also has a scrolling carousel of partner logos on the front page of their site – all using the exact same data.
Custom Meta Boxes for CPTs
I actually removed the code I use to add a “Link” field to my client’s custom post type because it didn’t seem important. But adding custom meta boxes to a CPT built with
register_post_type()
is fairly easy.Step 1: Add a metabox callback to your
$args
array:Then define the callback function:
In this specific example, I’m adding a meta box that allows the user to add a link to the external manufacturer’s website. The core functionality is in the function
manufacturer_link_meta_box()
and it follows all of the normal rules that custom meta boxes follow.Full code for meta boxes
PLEASE DO NOT USE THIS CODE VERBATIM IN YOUR SITE! You will absolutely need to modify the code to fit your purposes, so don’t just copy-paste this into your own system.
You could use custom post types,
search for. See EAMannâs answer.portfolio
to get a ton of examplesOr just use the link manager. For simple links with images it is good enough.
You can create a very customizable list then with
wp_list_bookmarks()
.Why not just use posts? You could create a post for each client and use the featured image (AKA Post Thumbnails) to display the logo’s. You can then set the post limit to 10 per page via the WordPress admin area:
Settings/Reading...Blog pages show at most 10