WordPress.org

Ready to get started?Download WordPress

Forums

Custom Post Types Menu an the Menu Editor (8 posts)

  1. muzzi
    Member
    Posted 4 years ago #

    Hi all,

    I've created a few custom page types for a project I'm working on, for this example lets say the post type is called 'Photos'.

    I've found that I can add a post in the 'Photos' page type to the menu using the WordPress 3.0 menu editor, but I can't add the whole section.

    Basically I want a link to myblog.com/photos/ in the menu, so my visitors can get a link to the list of the posts added under the 'Photos' post type. Is this possible?

    (Note, one of the reasons I don't want to use categories is that I don't want the URL to be myblog.com/category/photos, but there are other reasons too, a custom post type is what I'm after)

  2. esmi
    Forum Moderator
    Posted 4 years ago #

    You could create a custom page template that lists all posts of a specific post type.

  3. muzzi
    Member
    Posted 4 years ago #

    hmmmmm, not the most elegant of solutions, but a possibility. Thanks for that!

  4. richiesun
    Member
    Posted 4 years ago #

    I had this same issue now resolved with no hacks really.

    1. Create your custom post type, i.e "Photos"
    2. Add a new "Pages" and name it the same name, "Photos"
    3. Go to Appearance->Menus and you'll see "Photos" under "Pages" on the left sidebar.
    4. Select "Photos" and add it to the menu you created and save it.
    5. Go into your wp-content->themes->theme_your_using directory and create a new page called page-photos.php.

    The code for page-photos.php can be as simple as: (Notice how post_type = 'photos')

    <?php
    get_header(); ?>
    
    <div id="container">
    <div id="content" role="main">
    
    <?php
    $loop = new WP_Query( array( 'post_type' => 'photos', 'posts_per_page' => 10 ) );
    while ( $loop->have_posts() ) : $loop->the_post();
    ?>
      <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    
    <?php
    echo '<div class="entry-content">';
    the_content();
    echo '</div>';
    endwhile;
    ?>
    </div><!-- #content -->
    </div><!-- #container -->
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    If you view your site, there should be a new link called "Photos" in your menu and the hyperlink should be http://www.myblog.com/photos.

    And clicking on it should bring you to a page where you'll see the list of all your photo custom posts.

    Without creating the new page, there is no way to access photos by going to http://myblog.com/photos. Only singles posts could be accessed. I tried every possibility and this process was probably the easiest to do over and over with different custom post types.

  5. sassymonkey
    Member
    Posted 4 years ago #

    Well, this certainly seems like a hack, especially since it would potentially create extra bits like Pages that aren't being used for what Pages are for and thereby confusing lay users (a.k.a. clients for whom I'm trying to create simply publishing solutions).

    I'm noticing the same issue and it seems like a huge oversight in the fundamental use of Menus and Custom Post Types in WP 3.

    Another illustration is in a project I'm starting with multiple vintners in a local wine tasting collective.

    I want to create a Custom Post Type for "Vintners". Within this section are multiple posts about the different vintners involved in the collective.

    Once the vintners are all added to the "Vintner" Custom Post Type, I should be able to drag it to a custom Menu in the same way that I can add a Page or a Category. It really should be that simple and seems so obvious that most WP users would want that.

    As a bonus, I want to add a custom hierarchy of Taxonomies for the different wines each vintner specializes in. For example:

    Red Varietals
    - Merlot
    - Cabernet
    - etc.
    White Varietals
    - Chardonnay
    - Viognier
    - etc.

    Whenever a vintner is added to the Vintners Custom Post Type, the terms may be checked for each.

    Once these terms are established as Taxonomy for the Vintners Custom Post Type, I want to be able to drag the terms about to create second and third level drop menus beneath Vintners. It would look like this in the site's menu:

    Vintners
    - Red Varietals
    -- Merlot
    -- Cabernet
    -- etc.
    - White Varietals
    -- Chardonnay
    -- Viognier
    -- etc.

    Ideally, I could create a "Vintner" Custom Post Type and click a checkbox for its designation in the Menus section to automatically include all of its Taxonomies in the menu.

    This way clients can take over publishing and create their own Taxonomies that get added to the parent menu automatically so that no one has to manually go into the Menus and add new terms after creating them in Custom Post Type section.

  6. m7csat
    Member
    Posted 4 years ago #

    I don't know if this will help, but check the screen options for the Menu Editor. I just discovered all my taxonomies there.

  7. suraj0008
    Member
    Posted 3 years ago #

    Hi All,

    I am trying to drag any link to wordpress editor in IE, but unable to drag and drop the hyper link in wordpress editor.
    Any suggestion will be appreciated.

  8. vitamincee
    Member
    Posted 3 years ago #

    sassymonkey - I'm looking to do exactly the same thing you needed. Were you able to find a solution?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.