Skip to content
Permalink
Browse files

[update]投稿ページ向けのカスタマイザでフォントサイズを変更する機能を追加

  • Loading branch information...
ultimate-ez committed Jan 29, 2018
1 parent 5f586a4 commit c503356486fbf6e99e17d0ffa88449736c568633
Showing with 109 additions and 55 deletions.
  1. +2 −0 functions.php
  2. +33 −0 lib/customizer/se-customizer-controls.php
  3. +70 −0 lib/se-func-custom-css.php
  4. +4 −55 lib/se-func-init.php
@@ -4,6 +4,8 @@
require_once ('lib/se-func-customizer.php');
require_once ('lib/se-func-custom-css.php');
require_once ('lib/se-func-widgets.php');
require_once ('lib/se-func-sidebars.php');
@@ -0,0 +1,33 @@
<?php
if( class_exists( 'WP_Customize_Control' ) ) {
class WP_Customize_Range extends WP_Customize_Control {
public $type = 'range';
public function __construct( $manager, $id, $args = array() ) {
parent::__construct( $manager, $id, $args );
$defaults = array(
'min' => 0,
'max' => 10,
'step' => 1
);
$args = wp_parse_args( $args, $defaults );
$this->min = $args['min'];
$this->max = $args['max'];
$this->step = $args['step'];
}
public function render_content() {
?>
<label>
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
<input class='range-slider' min="<?php echo $this->min ?>" max="<?php echo $this->max ?>" step="<?php echo $this->step ?>" type='range' <?php $this->link(); ?> value="<?php echo esc_attr( $this->value() ); ?>" oninput="jQuery(this).next('input').val( jQuery(this).val() )">
<input onKeyUp="jQuery(this).prev('input').val( jQuery(this).val() )" type='text' value='<?php echo esc_attr( $this->value() ); ?>'>

</label>
<?php
}
}
}
?>
@@ -0,0 +1,70 @@
<?php
function sentry_custom_css(){
$defaultColor = '#F7786B';
$primaryColor = esc_html( get_theme_mod( 'sentry-color', $defaultColor ) );
$defaultFontSize = '15';
$fontSize = absint( get_theme_mod( 'article_font_size', '16' ) );
$fontSizeH2 = absint( $fontSize*1.25);
$output = '';
// PrimaryColor
$output .= "a,
article section.entry-content a:not(.button):visited,
article section.entry-content #toc_container a:hover,
article section.entry-content h4:before,
article section.entry-content h5:before,
article section.entry-content h6:before,
article footer.entry-foot .tags a,
article#notfound h1 i.fa,
.profile a:hover
{
color:{$primaryColor};
}
";
$output .="
.header,
nav .sentry-nav .hidden-links,
article section.entry-content h2,
.sentry-widget h1,
article section.entry-content .pochireba .pochi_info .pochi_price,
article footer.entry-foot .categories a,
.main-loop li a .post-info .category,
#nav-below .page-numbers.next,
.sentry-widget td a,
.sentry-widget .tagcloud a:hover,
.sentry-widget #se_popular_posts .tabs li.is-active,
#comments #comment_submit,
main.home section.popular-posts ul.wpp-list li a .content .post-text:before,
.slick-dots li.slick-active button,
.sentry-widget #wp-calendar td a,
article .entry-content .short-posts a .tag,
.wpcf7 .wpcf7-submit{
background:{$primaryColor};
}
article section.entry-content h3,
article footer.entry-foot .tags a,
.sentry-widget #se_popular_posts .tabs li.is-active {
border-color:{$primaryColor};
}";
// article fonts
$output .= "
article section.entry-content,
section.archive section.entry-content,
section.search section.entry-content{
font-size: {$fontSize}px;
}
article section.entry-content h2,
section.archive section.entry-content h2,
section.search section.entry-content h2{
font-size: {$fontSizeH2}px;
}
";
return $output;
}
?>
@@ -49,7 +49,10 @@ function sentry_enqueue_script() {
wp_enqueue_style( 'bluma', '//cdnjs.cloudflare.com/ajax/libs/bulma/0.1.0/css/bulma.css' );
wp_enqueue_style( 'sentry', get_template_directory_uri().'/css/sentry.css', array(), wp_theme_version(), false );
wp_enqueue_style( 'yakuhan', '//cdn.rawgit.com/qrac/yakuhanjp/master/dist/css/yakuhanjp.css');
wp_enqueue_style( 'sentry-custom', get_stylesheet_uri() );
wp_add_inline_style( 'sentry', sentry_custom_css() );
wp_enqueue_style( 'sentry-custom', get_stylesheet_uri(), 'sentry', wp_theme_version(), false );
/* infinitescroll */
wp_register_script( 'wp_infinite_scroll', get_template_directory_uri() . '/js/jquery.infinitescroll.min.js', array('jquery'), null, true );
@@ -146,60 +149,6 @@ function sentry_excerpt_more($more) {
add_filter( 'excerpt_more', 'sentry_excerpt_more');
add_filter( 'excerpt_length', 'sentry_excerpt_length');
if ( ! function_exists( 'sentry_color' ) ) {
function sentry_color(){
$defaultColor = '#F7786B';
if ( get_theme_mod( 'sentry-color' ) != "" ){
$primaryColor = esc_attr( get_theme_mod( 'sentry-color' ));
} else{
$primaryColor = $defaultColor;
}
?>
<style type="text/css">
a,
article section.entry-content a:not(.button):visited,
article section.entry-content #toc_container a:hover,
article section.entry-content h4:before,
article section.entry-content h5:before,
article section.entry-content h6:before,
article footer.entry-foot .tags a,
article#notfound h1 i.fa,
.profile a:hover
{
color: <?php echo $primaryColor; ?>;
}
.header,
nav .sentry-nav .hidden-links,
article section.entry-content h2,
.sentry-widget h1,
article section.entry-content .pochireba .pochi_info .pochi_price,
article footer.entry-foot .categories a,
.main-loop li a .post-info .category,
#nav-below .page-numbers.next,
.sentry-widget td a,
.sentry-widget .tagcloud a:hover,
.sentry-widget #se_popular_posts .tabs li.is-active,
#comments #comment_submit,
main.home section.popular-posts ul.wpp-list li a .content .post-text:before,
.slick-dots li.slick-active button,
.sentry-widget #wp-calendar td a,
article .entry-content .short-posts a .tag,
.wpcf7 .wpcf7-submit{
background: <?php echo $primaryColor; ?>;
}
article section.entry-content h3,
article footer.entry-foot .tags a,
.sentry-widget #se_popular_posts .tabs li.is-active {
border-color: <?php echo $primaryColor; ?>;
}
</style>
<?php
}
}
add_action( 'wp_head', 'sentry_color' );
// Checkbox用サニタイズ
if ( ! function_exists( 'sanitize_checkbox' ) ) {
function sanitize_checkbox($input){

0 comments on commit c503356

Please sign in to comment.
You can’t perform that action at this time.