function cf_search_join( $join ) {
global $wpdb;
if ( is_search() ) {
$join .=' LEFT JOIN '.$wpdb->postmeta. ' ON '. $wpdb->posts . '.ID = ' . $wpdb->postmeta . '.post_id ';
}
return $join;
}
add_filter( 'posts_join', 'cf_search_join' );
function cf_search_where( $where ) {
global $pagenow, $wpdb;
if ( is_search() ) {
$where = preg_replace(
"/\(\s*".$wpdb->posts.".post_title\s+LIKE\s*(\'[^\']+\')\s*\)/",
"(".$wpdb->posts.".post_title LIKE $1) OR (".$wpdb->postmeta.".meta_value LIKE $1)", $where );
}
return $where;
}
add_filter( 'posts_where', 'cf_search_where' );
function cf_search_distinct( $where ) {
global $wpdb;
if ( is_search() ) {
return "DISTINCT";
}
return $where;
}
add_filter( 'posts_distinct', 'cf_search_distinct' );
$('.num').each(function() {
$({ value: 0 }).animate({ value: +$(this).text() }, {
duration: 1000,
easing: 'linear',
step: val => $(this).text(val.toFixed(2)),
});
});
function lvl_home_post_slides( $atts ) {
...
$options = array(
'post_type' => $args['type'],
'posts_per_page' => $args['posts'],
'post_status' => 'publish',
'orderby' => array(
'post_date' => 'DESC',
'meta_value' => 'ASC'
),
'meta_key' => 'event_date'
);
$query = new WP_Query( $options );
...
}
add_shortcode( 'portfolio', 'call_shortcode_portfolio' );
function call_shortcode_portfolio( $atts, $content = '' ) {
$atts = shortcode_atts( array( 'id' => null ), $atts );
$query = new WP_Query( array( 'post_type' => 'your_custom_post_type', 'p' => intval( $atts['id'] ) ) );
}
$(document).ready(function() {
$("a.scrollto").click(function () {
elementClick = $(this).attr("href")
destination = $(elementClick).offset().top;
$("html:not(:animated),body:not(:animated)").animate({scrollTop: destination - *высота шапки*}, 1100);
return false;
});
});
scrollto