How I Can Use The Get Value as A Slug

You don’t need to do anything with rewrite rules. Your example (“domain.com/example-slug/?holder=value”) is a perfect example of “Plain” Permalinks. So your starting point is to set Permalinks (Settings > Permalinks) to something other than “Plain”. This will take the “/?” component out of the URL, and generate a URL in your preferred format. The second … Read more

Add parent template name to body class filter when visiting subpage or single post

here: add_filter(‘body_class’,’body_class_slugs’); function body_class_slugs($classes) { global $posts,$post; if(is_single() || is_page()){ //only on a single post or page if (isset($posts)){ $classes[] = $post[0]->post_name; //posts is an array of posts so we use the first one by calling [0] } elseif (isset($post)){ $classes[] = $post->post_name; } } return $classes; }

Custom Permalink with Dynamic Taxonomy for Custom Post Type – Works, but breaks other permalinks

If you’re running WordPress 3.0.1 or later, I believe your problem lies with the ‘post_type_link’ filter declaration and function arguments. When the ‘post_type_link’ filter is applied, it passes the following 4 arguments: apply_filters(‘post_type_link’, $post_link, $post, $leavename, $sample); But your function accepts $post_link and $id. Try the following adjustments: function custom_post_link( $post_link, $post ) { if … Read more

Remove Taxonomy Slug when No Taxonomy is Assigned to Custom Post Type?

With helpful tips from Milo, I was able to remove the taxonomy slug when no taxonomy is assigned to the custom post type by adding the following code to the updated functions above: add_filter( ‘request’, ‘project_request_filter’ ); function project_request_filter( $request ){ if( array_key_exists( ‘project’ , $request ) && ! get_term_by( ‘slug’, $request[‘project’], ‘project’ ) ){ … Read more

Using Blog Parent Slug on Blog Posts Only

Just set your custom permalink structure to: /theblog/%postname%/ If you have any custom post types used on your site, you’ll need to make sure that they don’t get the /theblog/ prepended to their URLs. To remove it, simply set with_front to false where the custom post types are registered: ‘rewrite’ => array(‘slug’ => ‘portfolio’, ‘with_front’ … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)