add_filter( 'default_content', 'custom_editor_content' );
function custom_editor_content( $content ) {
ob_start();
the_tags( '', ' - ' );
$tags = ob_get_clean();
$html = <<<CONTENT
<div class="content-col-main">
This is your main page content
</div>
<div class="content-col-side">
This is your sidebar content
</div>
<div class="content3">
%s
</div>
CONTENT;
$content = sprintf( $html, $tags );
return $content;
}
// получить слаг
$url_path = parse_url( $url, PHP_URL_PATH );
$slug = pathinfo( $url_path, PATHINFO_BASENAME );
//получит пост
$args=array(
'name' => $slug,
'post_type' => $post_type,
'posts_per_page' => 1
);
$post = get_posts( $args );
//получить ID
$post_ID = !empty($post->ID) ? $post->ID: false;
#можно так
echo TEMPLATEPATH . 'part/to/action/php';
# а можно так
echo home_url('/action_page')
require_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-load.php' );
add_action( 'init', 'create_taxonomy' );
function create_taxonomy() {
register_taxonomy( 'taxonomy', [ 'post' ], [] );
}
#https://wordpress.stackexchange.com/questions/275213/remove-child-products-from-woocommerce-category-page#answer-275260
function exclude_product_cat_children( $wp_query ) {
if ( isset( $wp_query->query_vars['product_cat'] ) && $wp_query->is_main_query() ) {
$wp_query->set(
'tax_query', array( array (
'taxonomy' => 'product_cat',
'field' => 'slug',
'terms' => $wp_query->query_vars['product_cat'],
'include_children' => false
) )
);
}
}
add_filter('pre_get_posts', 'exclude_product_cat_children');