<input id="check" name="check" type="hidden" value="" />
onclick="document.getElementById('check').value = 'secretcode';"
<button onclick="document.getElementById('check').value = 'secretcode';" type="submit">Отправить</button>
if ($_POST['check'] != 'secretcode') exit('Spam decected');
get_posts
не работает, нужно менять на WP_Query, я нашел тут сей код: <?php
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$args = array(
'post_type' => 'custom_post_type_name',
'posts_per_page' => 10,
'paged' => $paged
);
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
//CPT. content
endwhile;
?>
<nav class="pagination">
<?php
$big = 999999999;
echo paginate_links( array(
'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $loop->max_num_pages,
'prev_text' => '«',
'next_text' => '»'
) );
?>
</nav>
<?php wp_reset_postdata(); ?>
<?php
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$args = array(
'posts_per_page' => 6,
'order' => 'ASC',
'post_type' => 'my_type_post',
'paged' => $paged
);
$loop = new WP_Query( $args );
?>
<?php
if( $loop->have_posts() ) {
while( $loop->have_posts() ){
$loop->the_post();
?>
<h3><?php the_title(); ?></h3>
// My HTML
<?php
}
wp_reset_postdata();
}
?>
// И в нужно контейнере - месте размещаем nav.
<code lang="php">
<nav class="pagination">
<?php
$big = 999999999;
echo paginate_links( array(
'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $loop->max_num_pages,
'prev_text' => '«',
'next_text' => '»'
) );
?>
</nav>
</code>
// Get the last 10 posts in the special_cat category.
<?php query_posts( 'category_name=special_cat&posts_per_page=10' ); ?>
<?php while ( have_posts() ) : the_post(); ?>
<!-- Do special_cat stuff... -->
<?php endwhile; ?>
<?php
if ( is_home() ) {
query_posts( 'cat=-1,-2,-3' );
}
?>
$cat = get_the_category()
var slick = $('.slider').slick({
//Тут параметры
});
//Теперь по клику на изображение magnific-popup реинициализируем слайдер
$('.img').click(function() {
slick.slick('refresh');
});
//- filename: root.jade
- var nav = [{url: '/', name: 'Home'}, {url: 'about.html', name: 'About'}....];
doctype html
html(lang="en")
block sharedVars
head
block title
body
ul.nav
each i in nav
+navItem(i.url, i.name, i.url == pageUrl)
block content
mixin navItem(url, name, current)
li.nav-item(class={active: current})
a.link(href=url)= name
extends root
append sharedVars
- var pageUrl = '/';
block title
| My title
block content
h1 Мой заголовок
.content
p Hello World