How to change custom post type slug without damage seo? [closed]

You can do this without losing SEO. Change the taxonomy slug from “watches-product” to “watches/product” register_taxonomy(‘wpsc_watch_product_category’, ‘wpsc_watch_product’, array( ‘hierarchical’ => true, ‘query_var’ => ‘watch_product_category’, ‘rewrite’ => array( ‘slug’ => ‘watches/product’ ), ‘labels’ => $labels, )); Install a 302 Redirect Plugin. This plugin will redirect all the traffic to new url.

Can I have a specific template for products even if they are standard posts and not CPT?

Filter template_include, check if the current post is a product and load the product template. Example: add_filter( ‘template_include’, function( $template ) { if ( ! is_singular() or ! get_post_meta( get_the_ID(), ‘price’, true ) ) return $template; return locate_template( ‘product-single.php’ ); }); How exactly you determine if a post is a product is up to your … Read more

Adding custom theme template to custom post type [duplicate]

File should be single-member_post.php instead of single-memberPost.php. In single-{posttype} , {post_type} is the $post_type argument of the register_post_type() function. Never use flush_rewrite_rules(); in init use it only on theme/plugin deactivate or activate. Since this is a theme you can use it on after_switch_theme hook. add_action( ‘init’, ‘my_cpt_init’ ); function register_cpt_member_post() { register_post_type( … ); } … Read more

ACF select box css color change

You will need to store the field value in a variable and use the get_field() instead of the_field() function. From there you can introduce your own custom control structure to set the color you want. Here is a snippet <?php //store the value in a variable first $option = get_field(“status”); if($option==”K dispozicii”){ ?> <p style=”color:green”>$option</p> … Read more

Why WordPress does not Use Separate Table for Post Types (When Registring)?

It would be a challenge to hunt down a specific moment in time when that particular decision had been made. My educated guess would be that storing CPT definitions persistently would complicate how they interact with rest of APIs (especially Rewrite and localization). WP is also relatively conservative with database structure. CPT are relatively young … Read more

WordPress Roles

Create function to give role a numeric value: function get_user_level($role){ switch ($role) { case ‘Contributor’: return 1; ); break; case ‘Author’: return 2; ); break; case ‘Editor’: return 4; break; case ‘Administrator’: return 5; break; case ‘Super Admin’: return 6; break; default: return 0; // default subscriber or other roles break; } } Now you … Read more