Custom Post Type and single-posttype template

I found solution. Big Thanks @Scribu Alternative to query_posts for main loop? Now works fine and no more 404 error. function wpse49295_alter_the_query( $request ) { $dummy_query = new WP_Query(); $dummy_query->parse_query( $request ); if ( $dummy_query->is_single() ) $request[‘post_type’] = ‘topic’; return $request; } add_filter( ‘request’, ‘wpse49295_alter_the_query’ );

Custom Taxonomy Archive URL rewrite

WordPress doesn’t generate an ‘archive of terms’ automatically. However, you’re current permalink structure is set up so that: www.example.com/my_taxo/my-term points to the ‘my-term’ archive page of the ‘my_taxo’ taxonomy (listing all posts with the ‘my-term’ tag). So what you can do is create a page with slug ‘my_taxo’: www.example.com/my_taxo Assign this page a custom template … Read more

How can i maintain permalink structure and avoid a 404 error when loading external content?

You could use a WordPress rewrite (as opposed to mod-rewrite) to solve the issue. function createRewriteRules( $rules ){ $newrules = null; $newrules = array(); $newrules[“catalog/?$”] = “index.php?page=xx”; $rules = $newrules + $rules; return $rules; } add_action(‘rewrite_rules_array’, ‘createRewriteRules’); You’ll need to flush the rules: http://codex.wordpress.org/Function_Reference/flush_rewrite_rules Your page-catalog.php file could then sniff the original url and do … Read more

Rewrite rules for using the same base slug for multiple content types

Ok, the solution here turned out to be setting the correct priority on the add_action hook. Since we’re all hooking into init to register our post types per the Codex, the priority will determine which register_post_type function gets called first and, by extension, the order of the generated rewrite rules. So, I needed my “gemstone” … Read more

wp_rewrite not working on third level url

Your regex is a little flaky – you shouldn’t specify the start anchor ^, and some support trailing slashes, others don’t – plus I’d opt for a better expression for matching page numbers. And you could certainly trim it down to: add_rewrite_rule( ‘activate/([^/]*)/?$’, ‘index.php?pagename=activate&akey=$matches[1]’,’top’ ); add_rewrite_rule( ‘users/?$’, ‘index.php?pagename=users’,’top’ ); add_rewrite_rule( ‘users/(most-active|recent|oldest|by-username)/?$’, ‘index.php?pagename=users&sort=$matches[1]’,’top’ ); add_rewrite_rule( ‘users/(most-active|recent|oldest|by-username)/paged/([0-9]{1,})/?$’, … Read more

Custom Taxonomy in Permalink from post type

Set your taxonomy slug to taxonomy_name and in your post type set the slug to taxonomy_name/%taxonomy_name_term% and flush rewrite rules (simply by going to permalink settings panel in the admin) And after that WordPress will be able to handle /taxonomy_name/%taxonomy_name_term%/post-name/ URLs. So all that is left to do is tell WordPress what %taxonomy_name_term% means and … Read more