add_action( 'pre_get_posts', 'tax_filter' );
function tax_filter( $query ){
if( ! is_admin() && $query->is_main_query() ){
if( $query->is_tax( 'object' ) ){
$query->set( 'posts_per_page', '3' );
}
}
}
- Go to WPML->Translation options or, if you're using the Translation Management module, WPML -> Translation Management->Multilingual content setup.
- You will see the option called:"Synchronize page template" Uncheck it and save.
While checking against particular roles in place of a capability is supported in part, this practice is discouraged as it may produce unreliable results.
post_gallery
.<?php
function my_post_gallery( $output, $attr, $instance ) {
$_attachments = get_posts( array('include' => $attr['include'], 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => $attr['orderby']) );
$attachments = array();
foreach ( $_attachments as $key => $val ) {
$attachments[$val->ID] = $_attachments[$key];
}
if ( empty( $attachments ) ) {
return '';
}
ob_start();
?>
<div class="gallery">
<?php
foreach ( $attachments as $i => $image ) :
$url = wp_get_attachment_url( $image->ID );
?>
<a href="<?php echo $url; ?>" class="gallery-item">
<?php echo wp_get_attachment_image( $image->ID, 'thumbnail' ); ?>
</a>
<?php endforeach; ?>
</div>
<?php
$output = ob_get_contents();
ob_end_clean();
return $output;
}
add_filter( 'post_gallery', 'my_post_gallery', 10, 3 );
body
понять куда примерно смотреть. Там может быть указано archive, single, page, page-template, category и т.д.WP_CONTENT_DIR
и WP_CONTENT_URL
.Вопрос: как сделать чтобы нужный шаблон был по умолчанию?
single-current_projects.php
?