Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Custom post types just show 404 page (WordPress 3.0)

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #29226
    Johan
    Member

    Hi, I’ve got a problem.

    So I wanted to try these "custom post types" in WP 3.0 RC1, which would make the administration of my site way more easier. For testing, I created a "portfolio" post type, all by the rules:

    Code:
    add_action(“init”, “register_my_posttypes”);
    function register_my_posttypes(){
    $portfolio_args = array(
    “label” => “Portfolio items”,
    “singular_label” => “Portfolio item”,
    “public” => true,
    “show_ui” => true,
    “cabability_type” => “post”,
    “rewrite” => true,
    “description” => “My portfolio items”,
    “supports” => array(“title”, “editor”, “custom_fields”, “thumbnail”, “excerpt”)
    );

    register_post_type(“portfolio”, $portfolio_args);;
    }

    Nothing wrong here, right? The "portfolio" type show up in the admin sidebar, and it’s viewable if I navigate to http://mysite.com/portfolio/<post-name&gt;.

    BUT, when I decided to create another one, for quick links, things got messed up. I just added code for another post type:

    Code:
    add_action(“init”, “register_my_posttypes”);
    function register_my_posttypes(){
    $portfolio_args = array(
    “label” => “Portfolio items”,
    “singular_label” => “Portfolio item”,
    “public” => true,
    “show_ui” => true,
    “cabability_type” => “post”,
    “rewrite” => true,
    “description” => “My portfolio items”,
    “supports” => array(“title”, “editor”, “custom_fields”, “thumbnail”, “excerpt”)
    );

    $quick_args = array(
    “label” => “Quickies”,
    “singular_label” => “Quickie”,
    “public” => true,
    “show_ui” => true,
    “cabability_type” => “post”,
    “rewrite” => true,
    “description” => “Quick tips and more”,
    “supports” => array(“title”, “editor”, “custom_fields”, “thumbnail”, “excerpt”)
    );

    register_post_type(“portfolio”, $portfolio_args);
    register_post_type(“quicktip”, $quick_args);
    }

    These quickies refuse to show up. I can add new, of course, but when I want to view them on my site (http://mysite.com/quicktip/<item&gt; the 404 page is shown.

    I’ve followed everything! I’ve got custom single pages created and named as well (single-quicktip.php, single-portfolio.php but it won’t load it in the quicktip case. Is there some obvious error in my code? I have a dedicated portfolio page created, for showing the complete portfolio. I thought that one could affect things, but I could still view single portfolio items after I removed the "portfolio" page. I also tried this out live on my online site (running WP 3.0 RC1). Same scenario here – the portfolio posts show up but a 404 is thrown when viewing any other custom post type.

    Would be awesome if someone could give me some help. If you need more code, just gimme a shout. I’ve thrown away enough hours at this already …

    / Johan

    #76945
    Johan
    Member

    No worries, guys. Think I solved it.

    You appearantly have to visit the "Permalinks" settings page in the admin panel whenever you’ve made changes in the post type registration code. WordPress needs to flush the permalinks settings, I guess. Got from this post: http://justintadlock.com/archives/2010/04/29/custom-post-types-in-wordpress

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Back End’ is closed to new topics and replies.