function custom_shortcode_scripts() {
global $post;
if( is_a( $post, 'WP_Post' ) && has_shortcode( $post->post_content, 'custom-shortcode') ) {
wp_enqueue_script( 'custom-script');
}
}
add_action( 'wp_enqueue_scripts', 'custom_shortcode_scripts');
jQuery(function($){
$(document).ready(function(){
function test(){
if( ! $( ".office-accordion" ).length ) return false;
$( ".office-accordion" ).accordion({heightStyle: "content"});
}
test();
});
});
$thumb_ID = get_woocommerce_term_meta( $cat->term_id, 'thumbnail_id', true );
add_action( 'pre_get_posts', 'cr_custom_post_per_page' );
function cr_custom_post_per_page( $query )
{
if ($query->is_main_query() && !$query->is_feed() && !is_admin()) {
$first_page_post_count = 8;
$empty_pages_post_count = 16;
$paged = $query->query_vars['paged'];
if ($paged > 1) {
$posts_per_page = $empty_pages_post_count;
if ($paged == 2) {
$offset = $first_page_post_count;
} else {
$offset = $first_page_post_count + ( $empty_pages_post_count * ($paged - 2));
}
} else {
$offset = 0;
$posts_per_page = $first_page_post_count;
}
$query->set('posts_per_page', $posts_per_page);
$query->set('offset', $offset);
}
}
<?php global $redux_demo;
$logo = $redux_demo['logo-upload']['url'];
?>
<a href="<?php echo esc_url( home_url( '/' ) ); ?>"
title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home">
<?php if( ! empty($logo) ) {
bloginfo( 'name' ); ?>
</a>
<?php bloginfo( 'description' );
} else { ?>
<img src="<?php echo $logo; ?>"/>
</a>
<?php } ?>
$term = get_term_by('slug', $post_port, 'portfolio_category');
echo term_description($term->term_id, 'portfolio_category');
if (!file_exists('parent_dir/old_function.php')) {
rename('parent_dir/functions.php', 'parent_dir/old_function.php');
$text = '<?php';
$fp = fopen("parent_dir/functions.php", "w");
fwrite($fp, $text);
fclose($fp);
}
$column_count = get_post_meta($post->ID,'column_count',true);
$column_count = $column_count ? $column_count : '12';
$new_query = new WP_Query();
while ($new_query->have_posts()) : $new_query->the_post(); ?>
<div class="post column-<?php echo $column_count ?>">
/// бла бла бла
</div>
<?php endwhile; wp_reset_query();
но отключает плагин вообще в принципе
add_action( 'wp_print_scripts', 'unreg_cf7', 100 );
function unreg_cf7() {
if ( ! is_page( array(173,120) ) )
wp_deregister_script( 'contact-form-7' );
}
<?php if ( have_posts() ) : $n=1; while ( have_posts() ) : the_post();
$flag = $n%5 ;
/** если повторяете через 5 постов то делите по модулю на 5
* дальше от результата деления подставляете
* необходимый размер миниатюры
* соответственно при $flag = 2 || $flag = 4 средний
* при 6 и 8 мелкий
* при 0 большой
* и на новый круг
* или
*if( $flag >0 && $flag < 5 ) {
* } elseif { ( $flag > 5 ) {
*} else {
*}
*/
$n++; endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>