$year = 2008;
$current_year = date( 'Y' );
echo '<ul>';
while ( $year <= $current_year ) {
echo '<li><a href="' . get_year_link( $year ) . '">' . $year . '</a></li>';
$year++;
}
echo '</ul>';
$year = 2008;
$current_year = date( 'Y' );
echo '<ul>';
while ( $year <= $current_year ) {
$args = array(
'year' => $year,
'post_status' => 'publish, future, draft, pending',
'posts_per_page' => 1,
'fields' => 'ids'
);
$posts = get_posts( $args );
if ( is_array( $posts ) && !empty( $posts ) ) {
echo '<li><a href="' . get_year_link( $year ) . '">' . $year . '</a></li>';
}
$year++;
}
echo '</ul>';
$args = array(
'posts_per_page' => 1,
'order' => 'ASC'
);
$posts = get_posts( $args );
if ( $posts ) {
$year = date( 'Y', strtotime( $posts[0]->post_date ) );
}
jQuery(function($){
$('#true_loadmore').on('click', function(){
var button = $(this);
var data = {
'action': 'loadmore',
'query': loadmore_params.posts, // that's how we get params from wp_localize_script() function
'page' : loadmore_params.current_page
};
$.ajax({
url : loadmore_params.ajaxurl,
data : data,
type : 'POST',
beforeSend : function (xhr) {
button.text(loadmoreBtnLoading);
},
success : function(data){
if( data ) {
var $container = $('.portfolio-wrap');
var $el = $(data);
// imagesLoaded фиксит косяки изотопа
$el.imagesLoaded(function() {
$container.append($el).isotope('appended', $el, true);
});
button.text(loadmoreBtnShowMore);
loadmore_params.current_page++;
if ( loadmore_params.current_page == loadmore_params.max_pages ) {
button.remove();
}
// you can also fire the "post-load" event here if you use a plugin that requires it
// $( document.body ).trigger( 'post-load' );
} else {
button.remove(); // если мы дошли до последней страницы постов, скроем кнопку
}
}
});
});
});
SELECT * FROM courses
WHERE
( start_event BETWEEN $data_start AND $data_end ) AND
( end_event BETWEEN $data_start AND $data_end )
SELECT * FROM courses
WHERE
( start_event >= $data_start AND start_event <= $data_end ) AND
( end_event >= $data_start AND end_event <= $data_end )
<?php
$arr = [
[
'name' => 'Найк',
'desc' => 'Кросовки',
],
[
'name' => 'Адидас',
'desc' => 'Кеды',
],
[
'name' => 'Найк',
'desc' => 'Тапки',
],
];
$result = [
'mark' => array_unique(array_column($arr, 'name')),
'type' => array_unique(array_column($arr, 'desc'))
];
?>
grid-template-areas
крутите и выстраиваете блоки как угодно. $arr = [
["small"=> "/images/0001_GOLD.jpg"],
["small"=> "/images/003_lux.jpg"],
["small"=> "/images/002_prod_3.jpg"],
["small"=> "/images/0002_GOLD.jpg"],
["small"=> "/images/002_prod_5.jpg"],
["small"=> "/images/002_lux.jpg"],
["small"=> "/images/002_prod_4.jpg"],
];
$lux = [];
$prod = [];
$gold = [];
foreach ($arr as $v) {
if(strpos($v['small'], 'lux') !== false) {
$lux[] = $v;
}
if(strpos($v['small'], 'prod_') !== false) {
$prod[] = $v;
}
if(strpos($v['small'], 'GOLD') !== false) {
$gold[] = $v;
}
}
print_r(array_merge($lux, $prod, $gold));