function remove_post_slug( $post_link, $post, $leavename ) {
if ( 'auto' != $post->post_type || 'publish' != $post->post_status ) {
return $post_link;
}
$post_link = str_replace( '/' . $post->post_type . '/', '/', $post_link );
return $post_link;
}
add_filter( 'post_type_link', 'remove_post_slug', 10, 3 );
function parse_request_trick( $query ) {
if ( ! $query->is_main_query() || 2 != count( $query->query ) || ! isset( $query->query['page'] ) ) {
return;
}
if ( ! empty( $query->query['name'] ) ) {
$query->set( 'post_type', array( 'post', 'auto', 'page' ) );
}
}
add_action( 'pre_get_posts', 'parse_request_trick' );
function custom_template( $template ) {
// @link https://codex.wordpress.org/Function_Reference/has_term
if ( is_single() && has_term( 'my-term', 'my-taxonomy' ) ) {
return locate_template( array( 'single-template.php' ) );
}
return $template;
}
add_filter( 'template_include', 'custom_template', 99 );
.slider {
width: 50%;
margin-left: 25px;
}
$lesson_id = 22; // ID категории уроки
$data = get_queried_object();
if( in_array( $lesson_id, get_ancestors( $data->term_id, $data->taxonomy ) ) ) :
echo 'Это дочерняя категория категории уроки.';
endif;