[WordPress] 테마 별도 수정 부분 정리

[Wordpress] 테마 별도 수정 부분 정리

  • 테마명 : hueman
  • 버전 : 2.1.9

아래 수정된 모든 파일들은 ChildTheme에 별도 저장 후 수정

style.css는 별도 수정 후 변경될 일이 없으므로 제외

functions.php

별도 수정할 functions/dynamic-styles.php 로드를 위해 아래 함수 추가

/* ------------------------------------------------------------------------- *
 *  Load theme files
/* ------------------------------------------------------------------------- */

if ( ! function_exists( 'alx_load_custom' ) ) {
  function alx_load_custom() {
    // Load dynamic styles
    load_template( get_template_directory() . '-child/functions/dynamic-styles.php' );
  }
}
add_action( 'after_setup_theme', 'alx_load_custom' );

functions/dynamic-styles.php

            // primary color
            // if ( ot_get_option('color-1') != '#3b8dbd' ) {
                $styles .= '
::selection { background-color: '.ot_get_option('color-1').'; }
::-moz-selection { background-color: '.ot_get_option('color-1').'; }

a,
.themeform label .required,
#flexslider-featured .flex-direction-nav .flex-next:hover,
#flexslider-featured .flex-direction-nav .flex-prev:hover,
.post-hover:hover .post-title a,
.post-title a:hover,
.s1 .post-nav li a:hover i,
.content .post-nav li a:hover i,
.post-related a:hover,
.s1 .widget_rss ul li a,
#footer .widget_rss ul li a,
.s1 .widget_calendar a,
#footer .widget_calendar a,
.s1 .alx-tab .tab-item-category a,
.s1 .alx-posts .post-item-category a,
.s1 .alx-tab li:hover .tab-item-title a,
.s1 .alx-tab li:hover .tab-item-comment a,
.s1 .alx-posts li:hover .post-item-title a,
#footer .alx-tab .tab-item-category a,
#footer .alx-posts .post-item-category a,
#footer .alx-tab li:hover .tab-item-title a,
#footer .alx-tab li:hover .tab-item-comment a,
#footer .alx-posts li:hover .post-item-title a,
.comment-tabs li.active a,
.comment-awaiting-moderation,
.child-menu a:hover,
.child-menu .current_page_item > a,
.wp-pagenavi a,

/* User Custom Added */
.post-edit-link:before,
.cat-item.current-cat > .avhec-widget-line,
.cat-item.current-cat > .avhec-widget-line > a,
.cat-item.current-cat > .avhec-widget-line:after,
.go-foot-note:before,
.download-attachments .download-title,
#wp_rp_first h3
{ color: '.ot_get_option('color-1').'; }

.post-link
{ border-bottom-color: '.ot_get_option('color-1').'; }

.themeform input[type="submit"],
.themeform button[type="submit"],
.s1 .sidebar-top,
.s1 .sidebar-toggle,
#flexslider-featured .flex-control-nav li a.flex-active,
.post-tags a:hover,
.s1 .widget_calendar caption,
#footer .widget_calendar caption,
.author-bio .bio-avatar:after,
.commentlist li.bypostauthor > .comment-body:after,
.commentlist li.comment-author-admin > .comment-body:after { background-color: '.ot_get_option('color-1').'; }

.post-format .format-container,
/* User Custom Added */
table { border-color: '.ot_get_option('color-1').'; }

.s1 .alx-tabs-nav li.active a,
#footer .alx-tabs-nav li.active a,
.comment-tabs li.active a,
.wp-pagenavi a:hover,
.wp-pagenavi a:active,
.wp-pagenavi span.current { border-bottom-color: '.ot_get_option('color-1').'!important; }
                '."\n";
            // }
            // secondary color
            // if ( ot_get_option('color-2') != '#82b965' ) {
                $styles .= '
.s2 .post-nav li a:hover i,
.s2 .widget_rss ul li a,
.s2 .widget_calendar a,
.s2 .alx-tab .tab-item-category a,
.s2 .alx-posts .post-item-category a,
.s2 .alx-tab li:hover .tab-item-title a,
.s2 .alx-tab li:hover .tab-item-comment a,
.s2 .alx-posts li:hover .post-item-title a,

/* User Custom Added */
ul li strong,  ol li strong, blockquote strong
{ color: '.ot_get_option('color-2').'; }

.s2 .sidebar-top,
.s2 .sidebar-toggle,
.post-comments,
.jp-play-bar,
.jp-volume-bar-value,
.s2 .widget_calendar caption
{ background-color: '.ot_get_option('color-2').'; }

/* User Custom Added */
.s2 .sidebar-top .themeform.searchform div input
{ border-color: '.ot_get_option('color-2').'; }

.s2 .alx-tabs-nav li.active a { border-bottom-color: '.ot_get_option('color-2').'; }
.post-comments span:before { border-right-color: '.ot_get_option('color-2').'; }
                '."\n";
            // }

inc/post-format.php

<?php if ( has_post_format( 'image' ) ): // Image ?>

    <div class="post-format">
        <div class="image-container">
            <?php if ( has_post_thumbnail() ) {
                // the_post_thumbnail('thumb-large');
                $caption = get_post(get_post_thumbnail_id())->post_excerpt;
                if ( isset($caption) && $caption ) echo '<div class="image-caption">'.$caption.'</div>';
            } ?>
        </div>
    </div>

<?php endif; ?>

inc/featured.php

                    jQuery('#flexslider-featured').flexslider({
                        animation: "slide",
                        useCSS: false, // Fix iPad flickering issue
                        slideshow: true,
                        directionNav: true,
                        controlNav: true,
                        pauseOnHover: true,
                        slideshowSpeed: 5000,
                        animationSpeed: 500,
                        smoothHeight: true,
                        touch: true
                    });

single.php

                    <p class="post-byline">
                        <?php _e('by','hueman'); ?> <?php the_author_posts_link(); ?> &middot;
                        <?php the_time(get_option('date_format')); ?>
                        <?php edit_post_link('Edit', _e(' · ','hueman')); ?>
                    </p>

content-featured.php

        <div class="post-meta group">
            <p class="post-category"><?php the_category(' / '); ?></p>
            <p class="post-date"><?php the_time(get_option('date_format')); ?></p>
        </div><!--/.post-meta-->

content.php

        <div class="post-thumbnail">
            <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
                <?php if ( has_post_thumbnail() ): ?>
                    <?php //the_post_thumbnail('thumb-medium'); ?>
                <?php elseif ( ot_get_option('placeholder') != 'off' ): ?>
                    <!-- <img src="<?php echo get_template_directory_uri(); ?>/img/thumb-medium.png" alt="<?php the_title(); ?>" /> -->
                <?php endif; ?>
                <?php if ( has_post_format('video') && !is_sticky() ) echo'<span class="thumb-icon"><i class="fa fa-play"></i></span>'; ?>
                <?php if ( has_post_format('audio') && !is_sticky() ) echo'<span class="thumb-icon"><i class="fa fa-volume-up"></i></span>'; ?>
                <?php if ( is_sticky() ) echo'<span class="thumb-icon"><i class="fa fa-star"></i></span>'; ?>
            </a>
            <?php if ( comments_open() && ( ot_get_option( 'comment-count' ) != 'off' ) ): ?>
                <a class="post-comments" href="<?php comments_link(); ?>"><span><i class="fa fa-comments-o"></i><?php comments_number( '0', '1', '%' ); ?></span></a>
            <?php endif; ?>
        </div><!--/.post-thumbnail-->

        <div class="post-meta group">
            <p class="post-category"><?php the_category(' / '); ?></p>
            <p class="post-date"><?php the_time(get_option('date_format')); ?></p>
        </div><!--/.post-meta-->

sidebar-2.php

        <?php if ( ot_get_option('sidebar-top') != 'off' ): ?>
        <div class="sidebar-top group">
            <div id="search-2" class="widget_search">
            <form method="get" class="searchform themeform" action="http://blog.vericras.com/">
                <div>
                    <input type="text" class="search" name="s" onblur="if(this.value=='')this.value='Search';" onfocus="if(this.value=='Search')this.value='';" value="Search">
                </div>
            </form>
            </div>
            <!-- <p class="side-icon-thinking"><?php _e('Thinking...','hueman'); ?></p> -->
        </div>
        <?php endif; ?>