Community Forums › Forums › Archived Forums › General Discussion › Add a custom post type in a menu
- This topic has 7 replies, 2 voices, and was last updated 10 years, 11 months ago by chikamiku.
-
AuthorPosts
-
October 12, 2013 at 2:15 am #66388chikamikuParticipant
Just two questions please.
How can I add a custom post type in a menu? Please explain the concept in a non-technical way.
What URL should I use to link a custom post type to a banner image?
Thanks and regards
October 13, 2013 at 6:21 am #66493Brad DaltonParticipantYou mean you want to add a link to a single custom post type or archive custom post type?
How did you create the custom post type? Can you link to it please.
October 13, 2013 at 6:43 am #66496chikamikuParticipantI created these custom post types by using a plugin called Custom Post Types UI. Creating a post type is perhaps not an issue. I am unable to to go to the next steps of actually displaying the post types properly in the top nav, and, in banners linking to images. on the homepage of the site or anywhere else.
I perhaps know the answer would be in creating custom templates for the purpose. But which code to use. Any code examples would be great if possible.
In the top nav, I want to link a post type showing all the posts in that post type. However, once I click on a certain post title, it should take me to that single post . This is some thing which regular posts already implement. But I do not know how to do it for custom post types.
Thanks again for the quick response.
Thanks and regards
October 13, 2013 at 6:46 am #66497chikamikuParticipantIs there any step-by-step tutorial explaining all these things in a genesis way? I got some clue for non-genesis themes. but I wanted to get info with reference to Genesis framework only.
Thanks and regards
October 13, 2013 at 6:59 am #66498Brad DaltonParticipantYou want an archive page template for your custom post types? http://www.carriedils.com/custom-post-type-archive-template/
Or you could simple copy and paste all this code.http://wpsites.net/web-design/add-responsive-portfolio-page-to-lifestyle-pro/
October 13, 2013 at 4:32 pm #66544chikamikuParticipantHello Brad,
Thank you again for the message. I got the following results after implementing both the links you sent me.
http://www.halalfriendlyhotel.com/masajid/The Masajid post type is showing up. However, I click on single post types as you can see the above.
I used the second link you sent me to create the files the tutorial you asked me to follow and got the following result for hotels post type. http://www.halalfriendlyhotel.com/hotels-2/
Could you please guide me where am I making mistakes?
Thanks and I hope to hear form you soon.
Thanks
October 13, 2013 at 10:15 pm #66576Brad DaltonParticipantMake sure you upload images which are exactly the same size as what the code uses and re-save your permalinks which will flush the re-write rules in your .htaccess.
October 22, 2013 at 3:12 pm #68283chikamikuParticipantBrad,
Thank you again. However, I am still struggling with this all. I thought I should try to create CPTs by adding few code lines instead of using a plugin. So I used the following code. I created a file called archive-trade-shows.php with the following code inside it. But with no luck.. Any clues on how to do that please.
Thanks again.
//* Add a custom post type
add_action( 'init', 'cd_post_type' );
function cd_post_type() {
// Trade Shows custom post type
register_post_type( 'tradeshow',
array(
'labels' => array(
'name' => __( 'Trade Shows' ),
'singular_name' => __( 'Trade Show' ),
),
'has_archive' => true,
'public' => true,
'show_ui' => true, // defaults to true so don't have to include
'show_in_menu' => true, // defaults to true so don't have to include
'rewrite' => array( 'slug' => 'portfolio' ),
'supports' => array( 'title', 'editor', 'genesis-seo', 'thumbnail','genesis-cpt-archives-settings' ),
)
);
} -
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.