Support › MB Custom Post Type › How do I integrate custom post with sidebar?Resolved
I've created a custom post type. I've also created a MetaBox. I've added the PHP code to my single.php file and set the "field_id". My problem is that I can't figure out how to get the MetaBox to tie to the Post Type and then put them into the sidebar. I figure the sidebar should be easy enough because I can use custom html so I should be able to insert shortcode into the sidebar component to solve that. At the moment, I'm not getting any error messages, but it is not displaying the post either.
What am I missing?
I appreciate your help!
Can you give me more details on "get the MetaBox to tie to the Post Type and then put them into the sidebar"? Do you mean registering a meta box (with custom fields) for the custom post type and outputting the custom fields' values in the sidebar?
Yes, that sounds correct.
Hi, to register a meta box for a custom post type, please:
Now go back to your custom post type edit screen and you'll see the meta box appear. Enter some info and update the post.
To show the custom fields's values in the sidebar, there are 2 ways:
Ok, I've done everything you said...with a couple of differences where my screen didn't match your description. I see the metabox in my custom post type, so that's great. The problem I'm having now is that no matter what I do, it still won't show in the side bar.
I've added a text widget to my sidebar and pasted the [rwmb_meta meta_key="mbQuotes"] in the Text tab. Nothing shows up.
I've added a text widget to my sidebar and pasted the code into the Visible tab. It shows the code and not the value of the post.
I've added a Shortcode Widget to my sidebar and pasted the code in there. Nothing Shows.
I've tried changing the mbQuotes (name of Metabox) to the actual field name within the metabox (txtQuotes) but got nothing.
I'm at a loss now.
Hi, do your fields have any prefix? In the shortcode, the
meta_key should be the full field ID, including the prefix (if any).
If you still have any trouble showing the data, please send me an email via the contact form.