Custom Post Type Pretty Structure

I’ve configure permastructure for posts to /blog/%postname%/, I’ve created a page with slug about-us and I used the code bellow to register team_member CPT and it is working. I think you had a extra “https://wordpress.stackexchange.com/” in the rewrite argument. Also, you don’t need to works with global $wp_rewrite; if you set the rewrite argument when … Read more

Different structure/content for posts from a custom post type

WordPress allows to do this rather neatly for pages, supporting page-$slug.php and page-$id.php templates in hierarchy. Unfortunately it doesn’t apply to posts and Custom Post Types. So your options are either handling this inside single-services.php (in one file, or by further including other template files) or adjusting hierarchy to use custom templates for your posts … Read more

Custom permalink structure for remote content pages

I think your problem has several solutions. If you don’t want to have one entry in WP database for each remote item, a possible solution could be to have a page with property slug and add a rewrite rule to get the ID number: add_action( ‘init’, ‘cyb_property_rewrite_rule’ ); function cyb_property_rewrite_rule() { add_rewrite_rule( ‘^property/([0-9]{1,})/?$’, ‘index.php?pagename=$matches[1]&remote_ID=$matches[2]’, ‘top’ … Read more

wordpress post_where set only for my costum post type

Please note that the post_Type query variable is not set for standard types (page, post and attachment, see WP_QUery class file line 2396 on trac), only for custom post types, so this is how you can test for each type, add_filter( ‘posts_where’ , ‘posts_where’, 10, 2); function posts_where( $args, $wp_query_obj ) { $type = $wp_query_obj->query_vars[‘post_type’]; … Read more