WordPress.org

Support

Support » How-To and Troubleshooting » Custom Type Permalinks

Custom Type Permalinks

  • Hey all,

    Backend custom types seem to work great but for some reason I can’t see them on my front end. When I goto /qualification/a-level-courses/ i get a ‘Not Found
    Apologies, but the page you requested could not be found. Perhaps searching will help.’

    I have been to permalinks and resaved just incase it was a rewrite issue.

    Also if i goto /a-level/courses it will redirect me to /qualification/a-level-courses so something seems to be working!

    I’m defining it like this:

    // Qualification
    		$qualification_labels = array(
    			'name' => _x('Qualifications', 'post type general name'),
    			'singular_name' => _x('Qualification', 'post type singular name'),
    			'add_new' => _x('Add New', 'qualification'),
    			'add_new_item' => __('Add New Qualification'),
    			'edit_item' => __('Edit Qualification'),
    			'new_item' => __('New Qualification'),
    			'view_item' => __('View Qualification'),
    			'search_items' => __('Search Qualification'),
    			'not_found' =>  __('No qualifications found'),
    			'not_found_in_trash' => __('No qualifications found in Trash'),
    			'parent_item_colon' => ''
    		);
    
    		register_post_type('qualification', array(
    			'labels' => $qualification_labels,
    			'singular_label' => __('Qualification'),
    			'public' => true,
    			'show_ui' => true,
    			'_builtin' => false,
    			'_edit_link' => 'post.php?post=%d',
    			'capability_type' => 'post',
    			'hierarchical' => true,
    			'rewrite' => array('slug'=>'qualification', 'with_front' => false ),
    			'query_var' => $base_slug,
    			//'taxonomies' => array('skill','industry'),
    			'supports' => array('title')
    		));

    It’s also in the CORE site of a wp3 multi-site (i am not using the subsites yet)

    Any ideas?

    Thanks!

Viewing 9 replies - 1 through 9 (of 9 total)
  • Just to note I also tried CMS Press and they also do the same thing (404)

    Wouldn’t say it’s http://core.trac.wordpress.org/ticket/14011 but perhaps another bug?

    Any ideas anyone?

    Installed a fresh version of wordpress 3.0 and didn’t setup multi-site and it’s still doing it!

    To display custom content types on your homepage, put this in your functions.php. In my example, ‘videos’ is a custom content type. So just change that to what you need.

    `/** display regular posts & specified custom post types on homepage **/
    add_filter( ‘pre_get_posts’, ‘my_get_posts’ );
    function my_get_posts( $query ) {
    if ( is_home() )
    $query->set( ‘post_type’, array( ‘post’, ‘videos’ ) );
    return $query;
    }`

    p.s. if you figure out how to get custom content types into your homepage feed, let me know!! I’m struggling with that one right now. But I’m loving CMS Press!

    BTW, delete the tick marks, the one at the beginning of the first line and the one following the curly bracket in the last line, before pasting into functions.php.

    I take that back. That code works, BUT will break built-in support for templating for CMS Press if you are using that (I am). I’m still searching for a way to display all post types on homepage with CMS Press.

    Thanks to CMS Press’s prettyboymp, we have this code that works to show all content types on the homepage and in the feed:

    /** CMS Press' prettyboymp's code **/
    /** Display all regular posts and specified custom content types on homepage & main feed **/
    add_filter( 'pre_get_posts', 'my_get_posts' );
    function my_get_posts( $query ) {
    	if ( $query->is_home || is_feed && !isset($query->query_vars['post_type']))
    		$query->set( 'post_type', array( 'post', 'tv' ));
    	return $query;
    }

    Enjoy!

    It seems that Custom Permalinks require a .htaccess file, which WordPress 3 doesn’t have. My hosting service was kind enough to fix that issue for me, as I know the guy personally, but this really a WP3 bug imho.
    I’ve read a lot of topics on pretty/custom Permalinks not working with WP3. I hope they fix the issue soon, because the kind of coding people post to fix the issue is just way past my knowledge, and I’m sure many others agree.

    yeah, I’ve had the same issue with WP3, it should be fixed as soon as enough of us complain. 🙂

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Custom Type Permalinks’ is closed to new replies.
Skip to toolbar