<?php
if (is_category([16,25,26])) {
include dirname(__FILE__).'/single-A.php';
} elseif (is_category([18,24])) {
include dirname(__FILE__).'/single-B.php';
} else {
include dirname(__FILE__).'/single-default.php';
}
<?php
$args = array(
'taxonomy' => array('post_tag','category'),
'hide_empty' => false, // не скрывать пустые
'number' => 0, // показывать все (по-умолчанию 45)
);
wp_tag_cloud($args);
?>
<?php
ob_start();?>
<a href="<?php the_permalink(); ?>" class="thumb-preview" rel="<?php zt_get_thumbnail2(); ?>"><img src="<?php zt_get_thumbnail(); ?>" alt="<?php the_title(); ?>" class="img250" /></a>
<?php
$code = ob_get_clean();
$args = array(
'limit' => 5,
'post_html' => '<li>{thumb} '.$code.'</li>'
);
wpp_get_mostpopular( $args );
?>
while ( have_posts() ) : the_post();
$class = get_post_meta(get_the_ID(), 'block-class', true);
echo '<section class="'.$class.'">';
...
echo '</section>';
endwhile;
function my_assets() {
wp_enqueue_style( 'theme-style', get_stylesheet_uri(), array( 'reset' ) );
wp_enqueue_style( 'reset', get_stylesheet_directory_uri() . '/reset.css' ) );
wp_enqueue_script( 'owl-carousel', get_stylesheet_directory_uri() . '/owl.carousel.js', array( 'jquery' ) );
wp_enqueue_script( 'theme-scripts', get_stylesheet_directory_uri() . '/website-scripts.js', array( 'owl-carousel', 'jquery' ), '1.0', true );
}
add_action( 'wp_enqueue_scripts', 'my_assets' );
if ($_SERVER['REQUEST_URI'] == '/old-post-url.html') {
header("HTTP/1.1 301 Moved Permanently");
header("Location: /new-post-url.html");
exit;
}
...
// остальной код страницы 404
reset($a);
if (!is_array($a)) $a = [];
reset($a);
<?php
$postText = get_the_content();
if (strpos($postText, '<!--block_id_1>')) {
ob_start();
include "block-id-1.php";
$block = ob_get_clean();
$postText = str_replace('<!--block_id_1>', $block, $postText);
}
echo $postText;
?>