Страница вверх ToTop
Добавляем в footer.php
<script type="text/javascript">
jQuery(function(){
jQuery(document).ready(function()
{
jQuery(".go-to-top").hide(),
jQuery(window).scroll(function()
{
var e=jQuery(window).scrollTop();
e>900?jQuery(".go-to-top").fadeIn():jQuery(".go-to-top").fadeOut()
}),
jQuery(".go-to-top").click(function()
{
return jQuery("html,header,body").animate({scrollTop:0},700),!1
})
})
});
</script>
<div class="go-to-top" style="display: none;">
<a class="" title="Наверх" href="#masthead"></a>
</div>
Добавляем в style.css
.go-to-top {
position: fixed;
bottom: 20px;
right: 12px;
z-index: 999;
}
.go-to-top a {
width: 45px;
height: 45px;
-webkit-border-radius: 40px;
-moz-border-radius: 40px;
border-radius: 40px;
display: block;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-size: 24px;
line-height: 44px;
font-family: 'FontAwesome';
background-color: #848484;
text-align: center;
color: #fff;
opacity: 0.5;
-moz-opacity: 0.5;
filter:alpha(opacity=50);
-ms-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-webkit-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
}
.go-to-top a:hover {
opacity: 1;
-moz-opacity: 1;
filter:alpha(opacity=100);
background-color: #6897e5;
}
.go-to-top a:before {
content: '\f102';
}
Читать далее в категории
add_filter('excerpt_more', 'new_excerpt_more');
function new_excerpt_more($more) {
global $post;
return ' <a href="'. get_permalink($post->ID) . '">Читать далее...</a>';
}
Подключение меню
В файле functions.php
register_nav_menus( array(
'top-menu' => 'Верхнее меню',
'main-menu' => 'Основное меню',
'footer-menu' => 'Меню подвала',
) );
Подключение стилей и скриптов
function wp_book_scripts() {
wp_enqueue_style( 'wp-book-style', get_stylesheet_uri() );
wp_enqueue_style( 'wp-book-font-awesome', get_template_directory_uri() . '/css/font-awesome.min.css' );
wp_enqueue_style( 'wp-book-print', get_template_directory_uri() . '/print.css', array(), '1.1', 'print' );
wp_enqueue_script('jquery');
wp_enqueue_script( 'wp-book-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20151215', true );
wp_enqueue_script( 'wp-book-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true );
wp_enqueue_script( 'wp-book-app', get_template_directory_uri() . '/js/app.js', array('jquery') );
wp_enqueue_script( 'bootstrap', get_template_directory_uri() . '/js/bootstrap.js', array( 'jquery' ) );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'wp_book_scripts' );
Подключение сайдбара
1.
function wp_book_widgets_init() {
register_sidebar( array(
'name' => 'Правый сайдбар',
'id' => 'sidebar-1',
'description' => 'Правый сайдбар',
));
}
add_action( 'widgets_init', 'wp_book_widgets_init' );
2.
<?php if ( ! dynamic_sidebar( 'sidebar-1' ) ) : ?>
<a href="/wp-admin/widgets.php">Добавте виджеты!</a>
<?php endif; ?>