If you’re not familiar, custom post types are a lot like a regular WordPress post, only you can use them to store whatever type of content you want (i.e. they’re not just for blog posts). For example, WooCommerce products are custom post types. Or the actual event listings in an event calendar plugin are also a custom post type.
But custom post types aren’t just beneficial in plugins – you can also create your own custom post types to help you display different types of information on your site. For example, the Design Bombs deal section is powered by a custom post type for easy organization/customization.
In this post, I’ll show you an easy, code-free way to both create and display custom post types on your WordPress site.
To make it concrete, I’m going to build a coupon custom post type based roughly on the aforementioned deals section. But you’ll be able to apply the same principles to any type of content on your own site.
What You Need To Create And Display Custom Post Types
If you search the WordPress.org plugin directory, you’ll find tons of plugins that can help you easily create a custom post type.
But here’s the issue with most of those plugins (at least for casual users):
While they can help you create a custom post type, they don’t necessarily help you display the content in your custom post type on the front-end of your site.
That’s why I recommend the Pods plugin. It’s well supported, has tons of documentation, and has the benefit of being free!
Another good option is the premium Toolset plugin, but I’m going to stick with Pods for this tutorial because I want to keep everything 100% free.
To get started, all you need is Pods installed and activated on your website. The whole process looks like this:
Create a custom post type for coupons
Add some custom fields to that post type so that we can store the coupon code and discount percentage
Create a template to actually display the coupons custom post type on the frontend site
Step 1: Create New Custom Post Type
Once you have the Pods plugin installed and activated, go to Pods Admin → Add New in your WordPress dashboard.
Then, select Create New:
On the next screen, leave the Content Type as Custom Post Type. Then, enter a singular and plural label. For this example, that’s:
Coupon
Coupons
Then, click Next Step.
Congratulations! You just created a custom post type. You should notice a new Coupons option in your dashboard sidebar (or whatever label you used):
Step 2: Add Custom Fields To Custom Post Type
Right now, if you went to Coupons → Add New, you’d basically see the normal WordPress editor.
But we want to use this custom post type to display something specific – a “deal”. Not just a regular WordPress post.
To make that easier, you can use something called a custom field. A custom field is an extra input area that shows up in the WordPress editor. For this example, three helpful custom fields would be:
Coupon Code
Discount
Link
To add a custom field, all you need to do is click Add Field in the Pods interface:
That will open up a new set of settings. First, give the field a Label. Then, use the Field Type drop-down to select what type of field you want to add:
Pods offers a number of premade field types for inputs like:
Text
Website
Date
Number
Etc.
For this example, you might want to do something like:
Coupon Code – text field
Discount – text field
Link – website field
Repeat the process for as many fields as you want to add. Then, you should see something like this:
Once you’re done, make sure to click Save Pod.
Step 3: Add Your Content
Now, you can go to Coupons → Add New to add your first coupon. You should see those new custom fields hanging out underneath the regular WordPress editor:
You can enter:
The title of the entry in the regular title box (that’s the store, for this example)
A description of the store/deal in the regular WordPress editor
The actual coupon code in the Coupon Code field
What the discount is in the Discount field
The deal link in the Deal Link box (this could be your affiliate link, for example)
Then you can publish your post and…
Wait! Where did our custom fields go?
See, this is what I was talking about earlier:
WordPress will output the regular WordPress editor fields for your custom post type. But it won’t output the custom fields by default.
Most custom post types plugins stop here and make you do the rest using PHP. But Pods actually gives you an easy way to get your custom fields to display on the frontend of your site.
Here’s how to do it…
Step 4: Create Pods Template For Your Content
Pods includes a helpful feature that lets you create a custom template for your custom post type using regular HTML and magic tags, rather than requiring you to create a template using PHP.
To access this area, go to Pods Admin → Templates → Add New. You should see a code editor:
Here’s how this editor works:
You can use regular HTML/CSS to format your page.
You can insert content from the regular WordPress fields and/or custom fields by choosing your custom post type from the Pod Reference drop-down. These are called magic tags.
When you select your custom post type from the drop-down, it will show all the available fields, including the custom fields that you added:
To insert a custom field, you open a new “magic tag” by typing {@. Then, you can select the field from the autosuggestions:
For example, if you do something like this:
It will just output those three fields for each entry:
So now, you’re kind of there…
But it’s not exactly looking great design wise, right?
To actually make things look good, you’ll need to add some basic HTML/CSS. Note that you can:
Add regular static text
Use divs for styling
Use magic tags inside HTML (like using a magic tag to create a link)
Etc.
For example, doing something like this (I’m using inline CSS so that you can see what’s happening):
Will generate a more appealing design on the frontend of your site:
Unfortunately, you do need at least some basic HTML and CSS to do this part well. But the big thing is that Pods’ magic tags completely eliminate PHP from the equation, which really does make the process a lot simpler than the alternatives.
Step 5: Force Custom Post Type To Use Template
To make Pods actually use the template that you just created, you’ll need to make one more quick change (I already made this so that I could take the example screenshots above).
Edit your custom post type by going to Pods Admin → Edit Pods.
Then:
Go to the Auto Template Options tab
Select Enable Automatic Pods Templates for this Pod
Choose your template from the Single item view template drop-down
Select Replace from the Single Template Location drop-down
Other Helpful Tips For Working With Your Custom Post Type In Pods
Here are some other tips for working with your new custom post type:
Creating Archive Pages
If you want to create an archive page to list all of your different coupons (rather than just the page to list a single coupon like I showed you above), you can create a new template to control what information displays on the archive page.
Then, follow a similar process to force your custom post type to use that in the Auto Template Options.
You’ll also need to go to the Advanced Options tab and turn on the Enable Archive Page option for your custom post type:
Adding Custom Taxonomies To Your Custom Post Type
If you want to add a taxonomy to your custom post type (like a tag or a category), you can use Pods to create a new taxonomy by going to Add New and selecting Custom Taxonomy from the drop-down.
Then, you can associate that taxonomy with your custom post type by using the Built-in Taxonomies section in the Advanced Options tab of the Edit Pod interface:
Once you get the hang of them, you’ll no longer be limited by the constrained world of posts and pages.
There’s still a whole lot more that you can learn – covering everything would take a whole series of posts. But for now, you should have a solid grasp of what it takes to create your own custom post type and actually display it on the frontend of your site.
Well written article on pods and cpt’s. I have a question, can pods use a cpt type that is created from a plugin? I have a church plugin (sermons) that is a cpt.
But the single template looks bad and I want to change it? Is this possible with Pods?
I have a CPT called Application (slug is foh_app) and I have created a Pod that is also called foh_app. I have created the template within the Pods Admin piece and associated it to the Pod.
But, where does it all display? You have sort of skipped that bit by use of phrases such as “Then you can publish your post and…” – well, I sort of get that. I presume you mean you publish your CPT (in your case Coupon and in my case Application).
All my application type posts are published and they are associated with standard WP categories. But I cannot see any data. Even if I have Category Pages.
So, looking at the template piece of your post – I created the template and did all the asociations that you stated in the Pod – but I still have no idea what URL to put in to see what I wish?
That again was no use: he but got another smile and a friendly look of the sort he no longer wanted. I said I thought I could gallop if Harry could, and in a few minutes we were up with the ambulance. It had stopped. There were several men about it, including Sergeant Jim and Kendall, which two had come from Quinn, and having just been in the ambulance, at Ferry's side, were now remounting, both of them openly in tears. "Hello, Kendall." We have this great advantage in dealing with Plato—that his philosophical writings have come down to us entire, while the thinkers who preceded him are known only through fragments and second-hand reports. Nor is the difference merely accidental. Plato was the creator of speculative literature, properly so called: he was the first and also the greatest artist that ever clothed abstract thought in language of appropriate majesty and splendour; and it is probably to their beauty of form that we owe the preservation of his writings. Rather unfortunately, however, along with the genuine works of the master, a certain number of pieces have been handed down to us under his name, of which some are almost universally admitted to be spurious, while the authenticity of others is a question on which the best scholars are still divided. In the absence of any very cogent external evidence, an immense amount of industry and learning has been expended on this subject, and the arguments employed on both sides sometimes make us doubt whether the reasoning powers of philologists are better developed than, according to Plato, were those of mathematicians in his time. The176 two extreme positions are occupied by Grote, who accepts the whole Alexandrian canon, and Krohn, who admits nothing but the Republic;115 while much more serious critics, such as Schaarschmidt, reject along with a mass of worthless compositions several Dialogues almost equal in interest and importance to those whose authenticity has never been doubted. The great historian of Greece seems to have been rather undiscriminating both in his scepticism and in his belief; and the exclusive importance which he attributed to contemporary testimony, or to what passed for such with him, may have unduly biassed his judgment in both directions. As it happens, the authority of the canon is much weaker than Grote imagined; but even granting his extreme contention, our view of Plato’s philosophy would not be seriously affected by it, for the pieces which are rejected by all other critics have no speculative importance whatever. The case would be far different were we to agree with those who impugn the genuineness of the Parmenides, the Sophist, the Statesman, the Philêbus, and the Laws; for these compositions mark a new departure in Platonism amounting to a complete transformation of its fundamental principles, which indeed is one of the reasons why their authenticity has been denied. Apart, however, from the numerous evidences of Platonic authorship furnished by the Dialogues themselves, as well as by the indirect references to them in Aristotle’s writings, it seems utterly incredible that a thinker scarcely, if at all, inferior to the master himself—as the supposed imitator must assuredly have been—should have consented to let his reasonings pass current under a false name, and that, too, the name of one whose teaching he in some respects controverted; while there is a further difficulty in assuming that his existence could pass unnoticed at a period marked by intense literary and philosophical activity. Readers who177 wish for fuller information on the subject will find in Zeller’s pages a careful and lucid digest of the whole controversy leading to a moderately conservative conclusion. Others will doubtless be content to accept Prof. Jowett’s verdict, that ‘on the whole not a sixteenth part of the writings which pass under the name of Plato, if we exclude the works rejected by the ancients themselves, can be fairly doubted by those who are willing to allow that a considerable change and growth may have taken place in his philosophy.’116 To which we may add that the Platonic dialogues, whether the work of one or more hands, and however widely differing among themselves, together represent a single phase of thought, and are appropriately studied as a connected series. Before entering on our task, one more difficulty remains to be noticed. Plato, although the greatest master of prose composition that ever lived, and for his time a remarkably voluminous author, cherished a strong dislike for books, and even affected to regret that the art of writing had ever been invented. A man, he said, might amuse himself by putting down his ideas on paper, and might even find written178 memoranda useful for private reference, but the only instruction worth speaking of was conveyed by oral communication, which made it possible for objections unforeseen by the teacher to be freely urged and answered.117 Such had been the method of Socrates, and such was doubtless the practice of Plato himself whenever it was possible for him to set forth his philosophy by word of mouth. It has been supposed, for this reason, that the great writer did not take his own books in earnest, and wished them to be regarded as no more than the elegant recreations of a leisure hour, while his deeper and more serious thoughts were reserved for lectures and conversations, of which, beyond a few allusions in Aristotle, every record has perished. That such, however, was not the case, may be easily shown. In the first place it is evident, from the extreme pains taken by Plato to throw his philosophical expositions into conversational form, that he did not despair of providing a literary substitute for spoken dialogue. Secondly, it is a strong confirmation of this theory that Aristotle, a personal friend and pupil of Plato during many years, should so frequently refer to the Dialogues as authoritative evidences of his master’s opinions on the most important topics. And, lastly, if it can be shown that the documents in question do actually embody a comprehensive and connected view of life and of the world, we shall feel satisfied that the oral teaching of Plato, had it been preserved, would not modify in any material degree the impression conveyed by his written compositions. breakfast in the kitchen by candle-light, and then drove the five The bargaining was interminable, something in this manner:— Then follows a long discussion in Hindi with the bystanders, who always escort a foreigner in a mob, ending in the question— There was a bright I. D. blanket spread on the ground a little way back from the fire, and she threw herself down upon it. All that was picturesque in his memories of history flashed back to Cairness, as he took his place beside Landor on the log and looked at her. Boadicea might have sat so in the depths of the Icenean forests, in the light of the torches of the Druids. So the Babylonian queen might have rested in the midst of her victorious armies, or she of Palmyra, after the lion hunt in the deserts of Syria. Her eyes, red lighted beneath the shadowing lashes, met his. Then she glanced away into the blackness of the pine forest, and calling her dog to lie down beside her, stroked its silky red head. The retreat was made, and the men found themselves again in the morning on the bleak, black heath of Drummossie, hungry and worn out, yet in expectation of a battle. There was yet time to do the only wise thing—retreat into the mountains, and depend upon a guerilla warfare, in which they would have the decided advantage. Lord George Murray now earnestly proposed this, but in vain. Sir Thomas Sheridan and other officers from France grew outrageous at that proposal, contending that they could easily beat the English, as they had done at Prestonpans and Falkirk—forgetting that the Highlanders then were full of vigour and spirit. Unfortunately, Charles listened to this foolish reasoning, and the fatal die was cast. "They said they were going for our breakfast," said Harry. "And I hope it's true, for I'm hungrier'n a rip-saw. But I could put off breakfast for awhile, if they'd only bring us our guns. I hope they'll be nice Springfield rifles that'll kill a man at a mile." "Dod durn it," blubbered Pete, "I ain't cryin' bekase Pm skeered. I'm cryin' bekase I'm afeared you'll lose me. I know durned well you'll lose me yit, with all this foolin' around." He came nearly every night. If she was not at the gate he would whistle a few bars of "Rio Bay," and she would steal out as soon as she could do so without rousing suspicion. Boarzell became theirs, their accomplice in some subtle, beautiful way. There was a little hollow on the western slope where they would crouch together and sniff the apricot scent of the gorse, which was ever afterwards to be the remembrancer of their love, and watch the farmhouse lights at Castweasel gleam and gutter beside Ramstile woods. "Yes, De Boteler," continued the lady, "I will write to him, and try to soothe his humour. You think it a humiliation—I would humble myself to the meanest serf that tills your land, could I learn the fate of my child. The abbot may have power to draw from this monk what he would conceal from us; I will at least make the experiment." The lady then, though much against De Boteler's wish, penned an epistle to the abbot, in which concession and apologies were made, and a strong invitation conveyed, that he would honour Sudley castle by his presence. The parchment was then folded, and dispatched to the abbot. "A very pretty method, truly! You know not the miners and forgers of Dean Forest!—why I would stake a noble to a silver-penny, that if you had discovered he was hidden there, and legally demanded him, he would be popped down in a bucket, to the bottom of some mine, where, even the art of Master Calverley could not have dragged him to the light of day until the Forest was clear of the pack:—but, however, to speak to the point," perceiving that the steward's patience was well nigh exhausted—"I saw Stephen Holgrave yesterday, in the Forest." HoME欧美一级 片a高清
ENTER NUMBET 0016www.foncti.org.cn eopfwj.com.cn www.hxgxih.com.cn jnyimu.org.cn www.shxmpt.com.cn thkljm.com.cn www.vjghq3.net.cn www.oboob.com.cn www.ueuhrg.com.cn www.osmxjy.org.cn
Nice tutorial. How to delete or hide the title generated in the pod custom post?
Hi,
Well written article on pods and cpt’s. I have a question, can pods use a cpt type that is created from a plugin? I have a church plugin (sermons) that is a cpt.
But the single template looks bad and I want to change it? Is this possible with Pods?
Thanks for the good article!
Mel
Awesome intro for newbies to CPTs like me. Many thanks
I’ve sort of followed this…
I have a CPT called Application (slug is foh_app) and I have created a Pod that is also called foh_app. I have created the template within the Pods Admin piece and associated it to the Pod.
But, where does it all display? You have sort of skipped that bit by use of phrases such as “Then you can publish your post and…” – well, I sort of get that. I presume you mean you publish your CPT (in your case Coupon and in my case Application).
All my application type posts are published and they are associated with standard WP categories. But I cannot see any data. Even if I have Category Pages.
So, looking at the template piece of your post – I created the template and did all the asociations that you stated in the Pod – but I still have no idea what URL to put in to see what I wish?
Can you help?
I sort of moved on from there after a lot of messing around. I still cannot list any CPTs on my category pages though. Any tips.
Many thanks
what will be the php code to display pods item (custom texonomy) itself instead of its fields?