代码提交
This commit is contained in:
+7
-5
@@ -11,16 +11,18 @@ get_header();
|
||||
?>
|
||||
|
||||
<main id="primary" class="site-main">
|
||||
|
||||
<br>
|
||||
<?php if ( have_posts() ) : ?>
|
||||
|
||||
<header class="page-header">
|
||||
<div class="notification is-primary">
|
||||
<p>
|
||||
<!-- <header class="page-header">-->
|
||||
<?php
|
||||
the_archive_title( '<h1 class="page-title">', '</h1>' );
|
||||
the_archive_description( '<div class="archive-description">', '</div>' );
|
||||
?>
|
||||
</header><!-- .page-header -->
|
||||
|
||||
</p>
|
||||
<!-- </header>-->
|
||||
</div>
|
||||
<?php
|
||||
/* Start the Loop */
|
||||
while ( have_posts() ) :
|
||||
|
||||
+62
-26
@@ -20,13 +20,17 @@ if ( post_password_required() ) {
|
||||
}
|
||||
?>
|
||||
|
||||
<div id="comments" class="comments-area">
|
||||
<div id="comments" class="comments-area" style=" margin-top: 15px;">
|
||||
<!-- <div class="container is-narrow">-->
|
||||
|
||||
<?php
|
||||
// You can start editing here -- including this comment!
|
||||
if ( have_comments() ) :
|
||||
?>
|
||||
<h2 class="comments-title">
|
||||
<div class="content">
|
||||
<div class="header">
|
||||
<h2 class="title is-3"><?php esc_html_e('评论区', 'cyywordpress'); ?></h2>
|
||||
<p class="subtitle">
|
||||
<?php
|
||||
$cyywordpress_comment_count = get_comments_number();
|
||||
if ( '1' === $cyywordpress_comment_count ) {
|
||||
@@ -44,34 +48,66 @@ if ( post_password_required() ) {
|
||||
);
|
||||
}
|
||||
?>
|
||||
</h2><!-- .comments-title -->
|
||||
</p><!-- .comments-title -->
|
||||
</div>
|
||||
|
||||
<?php the_comments_navigation(); ?>
|
||||
|
||||
<ol class="comment-list">
|
||||
<?php
|
||||
wp_list_comments(
|
||||
array(
|
||||
'style' => 'ol',
|
||||
'short_ping' => true,
|
||||
)
|
||||
);
|
||||
?>
|
||||
</ol><!-- .comment-list -->
|
||||
<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>
|
||||
<nav id="comment-nav-above" class="navigation comment-navigation" role="navigation">
|
||||
<h2 class="screen-reader-text"><?php esc_html_e( 'Comment navigation', 'cyywordpress' ); ?></h2>
|
||||
<div class="nav-links level">
|
||||
<div class="nav-next"><?php next_comments_link( esc_html__( 'Newer Comments', 'cyywordpress' ) ); ?></div>
|
||||
<div class="nav-previous"><?php previous_comments_link( esc_html__( 'Older Comments', 'cyywordpress' ) ); ?></div>
|
||||
</div><!-- .nav-links -->
|
||||
</nav><!-- #comment-nav-above -->
|
||||
<?php endif; // Check for comment navigation. ?>
|
||||
|
||||
<?php
|
||||
the_comments_navigation();
|
||||
|
||||
// If comments are closed and there are comments, let's leave a little note, shall we?
|
||||
if ( ! comments_open() ) :
|
||||
?>
|
||||
<p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'cyywordpress' ); ?></p>
|
||||
<?php
|
||||
endif;
|
||||
<ul class="comment-list ">
|
||||
<?php
|
||||
wp_list_comments( array(
|
||||
'style' => 'ul',
|
||||
'short_ping' => true,
|
||||
'avatar_size' => 50
|
||||
) );
|
||||
?>
|
||||
</ul><!-- .comment-list -->
|
||||
<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>
|
||||
<nav id="comment-nav-below" class="navigation comment-navigation" role="navigation">
|
||||
<h2 class="screen-reader-text"><?php esc_html_e( 'Comment navigation', 'cyywordpress' ); ?></h2>
|
||||
<div class="nav-links level">
|
||||
<div class="nav-next"><?php next_comments_link( esc_html__( 'Newer Comments', 'cyywordpress' ) ); ?></div>
|
||||
<div class="nav-previous"><?php previous_comments_link( esc_html__( 'Older Comments', 'cyywordpress' ) ); ?></div>
|
||||
</div><!-- .nav-links -->
|
||||
</nav><!-- #comment-nav-below -->
|
||||
<?php
|
||||
endif; // Check for comment navigation.
|
||||
?>
|
||||
</div>
|
||||
|
||||
endif; // Check for have_comments().
|
||||
|
||||
comment_form();
|
||||
?>
|
||||
<?php
|
||||
endif; // Check for have_comments().
|
||||
?>
|
||||
|
||||
<?php
|
||||
// If comments are closed and there are comments, let's leave a little note, shall we?
|
||||
if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : ?>
|
||||
<div class="content">
|
||||
<p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'cyywordpress' ); ?></p>
|
||||
</div>
|
||||
<?php
|
||||
endif;
|
||||
?>
|
||||
<?php $comment_args = array(
|
||||
'title_reply'=>'<h3 class="title is-3">有什么要说的吗?</h3>',
|
||||
'comment_field' => '<div class="columns is-multiline"><div class="column '. (is_user_logged_in() ? 'is-full' : 'is-half') .'"><label class="label" for="comment">' . __( '您的评论' ) . '</label>' . '<p class="control">' . '<textarea class="textarea" id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea>' . '</p></div>',
|
||||
'fields' => apply_filters( 'comment_form_default_fields', array(
|
||||
'author' => '<div class="column is-half"><label class="label" for="author">' . __( '昵称' ) . ( $req ? '<span>*</span>' : '' ) .'</label> ' . '<p class="control">' . '<input class="input" id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></p>',
|
||||
'email' => '<label class="label" for="email">' . __( '邮箱' ) . ( $req ? '<span>*</span>' : '' ) . '</label> ' . '<p class="control">' . '<input class="input" id="email" name="email" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' />'.'</p>',
|
||||
'url' => '</div>' ) ),
|
||||
'comment_notes_after' => '',
|
||||
'submit_button' => '<div class="column is-full"><div class="control"><input name="submit" type="submit" id="submit" class="button is-info is-outlined post-comment-button" value="提交评论" /></div></div></div>'
|
||||
);
|
||||
comment_form($comment_args); ?>
|
||||
<!-- </div>-->
|
||||
</div><!-- #comments -->
|
||||
|
||||
+17
@@ -60,6 +60,23 @@
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// 当网页向下滑动 20px 出现"返回顶部" 按钮
|
||||
window.onscroll = function() {scrollFunction()};
|
||||
|
||||
function scrollFunction() {console.log(121);
|
||||
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
|
||||
document.getElementById("myBtn").style.display = "block";
|
||||
} else {
|
||||
document.getElementById("myBtn").style.display = "none";
|
||||
}
|
||||
}
|
||||
|
||||
// 点击按钮,返回顶部
|
||||
function topFunction() {
|
||||
document.body.scrollTop = 0;
|
||||
document.documentElement.scrollTop = 0;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@@ -192,3 +192,7 @@ if ( defined( 'JETPACK__VERSION' ) ) {
|
||||
}
|
||||
|
||||
require get_template_directory() . '/inc/bulmapress_navwalker.php';
|
||||
require get_template_directory() . '/inc/search.php';
|
||||
require get_template_directory() . '/inc/pagination.php';
|
||||
|
||||
|
||||
|
||||
+10
-9
@@ -26,6 +26,7 @@
|
||||
<?php wp_body_open(); ?>
|
||||
<div id="page" class="site">
|
||||
<!-- <a class="skip-link screen-reader-text" href="#primary">--><?php //esc_html_e( 'Skip to content', 'cyywordpress' ); ?><!--</a>-->
|
||||
<button onclick="topFunction()" id="myBtn" title="回顶部">返回顶部</button>
|
||||
|
||||
|
||||
<nav class="navbar" style="box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .1), 0 1px 2px 0 rgba(0, 0, 0, .06) !important;" role="navigation" aria-label="main navigation">
|
||||
@@ -59,22 +60,22 @@
|
||||
?>
|
||||
<div class="navbar-item has-dropdown is-hoverable">
|
||||
<a class="navbar-link">
|
||||
More
|
||||
更多
|
||||
</a>
|
||||
|
||||
<div class="navbar-dropdown">
|
||||
<a class="navbar-item">
|
||||
About
|
||||
<a class="navbar-item" href="https://kaifa.baidu.com/" target="_blank">
|
||||
开发者搜索(Baidu)
|
||||
</a>
|
||||
<a class="navbar-item">
|
||||
Jobs
|
||||
<a class="navbar-item" href="https://learnku.com/" target="_blank">
|
||||
编程者论坛(LearnKu)
|
||||
</a>
|
||||
<a class="navbar-item">
|
||||
Contact
|
||||
<a class="navbar-item" href="http://www.oschina.net/" target="_blank">
|
||||
程序员资讯(osChina)
|
||||
</a>
|
||||
<hr class="navbar-divider">
|
||||
<a class="navbar-item">
|
||||
Report an issue
|
||||
<a class="navbar-item" href="http://yaoyuan.io" target="_blank">
|
||||
更多(chuyaoyuan)
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* Pagination Functions
|
||||
*
|
||||
* @package cyywordpress
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'cyywordpress_pagination' ) ) {
|
||||
/**
|
||||
* Add custom pagination class
|
||||
*
|
||||
* @link https://css-tricks.com/snippets/wordpress/add-class-to-links-generated-by-next_posts_link-and-previous_posts_link/
|
||||
*/
|
||||
function cyywordpress_pagination($args = [], $class = 'pagination') {
|
||||
|
||||
if ($GLOBALS['wp_query']->max_num_pages <= 1) return;
|
||||
|
||||
$args = wp_parse_args( $args, [
|
||||
'mid_size' => 2,
|
||||
'prev_next' => false,
|
||||
'prev_text' => __('Older posts', 'cyywordpress'),
|
||||
'next_text' => __('Newer posts', 'cyywordpress'),
|
||||
'screen_reader_text' => __('Posts navigation', 'cyywordpress'),
|
||||
]);
|
||||
|
||||
$links = paginate_links($args);
|
||||
$next_link = get_previous_posts_link($args['next_text']);
|
||||
$prev_link = get_next_posts_link($args['prev_text']);
|
||||
$template = apply_filters( 'navigation_markup_template', '
|
||||
<nav class="navigation %1$s" role="navigation">
|
||||
<h2 class="screen-reader-text">%2$s</h2>
|
||||
<div class="nav-links level">%3$s<div class="page-numbers-container level">%4$s</div>%5$s</div>
|
||||
</nav>', $args, $class);
|
||||
|
||||
echo sprintf($template, $class, $args['screen_reader_text'], $next_link, $links, $prev_link);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
* cyywordpress Search Functions
|
||||
*
|
||||
* @package cyywordpress
|
||||
*/
|
||||
|
||||
//<label class="screen-reader-text" for="s">' . __( 'Search for:' ) . '</label>
|
||||
if ( ! function_exists( 'cyywordpress_search_form' ) ) {
|
||||
function cyywordpress_search_form( $form ) {
|
||||
$form = '
|
||||
<form role="search" method="get" id="searchform" class="searchform" action="' . home_url( '/' ) . '" >
|
||||
<h2 class="widget-title is-bold">搜索</h2>
|
||||
<div class="control has-addons" style=" display: flex;">
|
||||
|
||||
<input class="input is-small" type="text" value="' . get_search_query() . '" name="s" id="s" />
|
||||
<input class="button is-small" type="submit" id="searchsubmit" value="'. esc_attr__( 'Submit' ) .'" />
|
||||
</div>
|
||||
</form>';
|
||||
|
||||
return $form;
|
||||
}
|
||||
}
|
||||
add_filter( 'get_search_form', 'cyywordpress_search_form', 100 );
|
||||
@@ -67,6 +67,7 @@ get_header();
|
||||
|
||||
endwhile;
|
||||
|
||||
|
||||
the_posts_navigation();
|
||||
|
||||
else :
|
||||
@@ -77,6 +78,23 @@ get_header();
|
||||
?>
|
||||
|
||||
|
||||
<br>
|
||||
<br>
|
||||
<!-- <div class="columns" style=" margin-bottom: 25px;">-->
|
||||
<!-- <div class="column is-narrow">-->
|
||||
<!-- <div class="box" style="width: 200px;">-->
|
||||
<!-- <p class="title is-5">预留位1</p>-->
|
||||
<!-- <p class="subtitle">预留文字.</p>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="column">-->
|
||||
<!-- <div class="box">-->
|
||||
<!-- <p class="title is-5">预留位2</p>-->
|
||||
<!-- <p class="subtitle">预留文字.</p>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ if ( ! is_active_sidebar( 'sidebar-1' ) ) {
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="columns">
|
||||
<div class="columns" style="margin-bottom: 10px;">
|
||||
<?php dynamic_sidebar( 'sidebar-1' ); ?>
|
||||
|
||||
</div>
|
||||
|
||||
+2
-2
@@ -45,8 +45,8 @@ get_header();
|
||||
|
||||
the_post_navigation(
|
||||
array(
|
||||
'prev_text' => '<span class="nav-subtitle">' . esc_html__( 'Previous:', 'cyywordpress' ) . '</span> <span class="nav-title">%title</span>',
|
||||
'next_text' => '<span class="nav-subtitle">' . esc_html__( 'Next:', 'cyywordpress' ) . '</span> <span class="nav-title">%title</span>',
|
||||
'prev_text' => '<span class="nav-subtitle">' . esc_html__( '上一篇:', 'cyywordpress' ) . '</span> <span class="nav-title">%title</span>',
|
||||
'next_text' => '<span class="nav-subtitle">' . esc_html__( '下一篇:', 'cyywordpress' ) . '</span> <span class="nav-title">%title</span>',
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@@ -66,3 +66,26 @@ Nicolas Gallagher and Jonathan Neal https://necolas.github.io/normalize.css/
|
||||
* 1. Correct the line height in all browsers.
|
||||
* 2. Prevent adjustments of font size after orientation changes in iOS.
|
||||
*/
|
||||
|
||||
.widget-title{
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
#myBtn {
|
||||
display: none;
|
||||
position: fixed;
|
||||
bottom: 20px;
|
||||
right: 30px;
|
||||
z-index: 99;
|
||||
border: none;
|
||||
outline: none;
|
||||
background-color: #00d1b2;
|
||||
color: #ece8e8;
|
||||
cursor: pointer;
|
||||
padding: 15px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
#myBtn:hover {
|
||||
background-color: #555;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user