1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

WordPressのテーマをカスタマイズ(twentyfifteen)

Last updated at Posted at 2015-04-20

前提

  • WordPressは/var/www/html/wordpressにinstall

設定

styleのoverride

  • 子テーマを作成する。
  • style.cssを親テーマから子テーマへコピー
$ cd /var/www/html/wordpress/wp-content/themes
$ mkdir twentyfifteen-child
$ cp twentyfifteen/style.css twentyfifteen-child/
$ emacs twentyfifteen-child/style.css
  • style.cssをoverrideする。(ここでは@includeで継承のみ)
twentyfifteen-child/style.css
/*                                                                                                                      
Theme Name: Twenty Fifteen Child                                                                                        
Template: twentyfifteen                                                                                                 
Theme URI: https://wordpress.org/themes/twentyfifteen                                                                   
Author: the WordPress team                                                                                              
Author URI: https://wordpress.org/                                                                                      
Description: Our 2015 default theme is clean, blog-focused, and designed for clarity. Twenty Fifteen's simple, straight\
forward typography is readable on a wide variety of screen sizes, and suitable for multiple languages. We designed it u\
sing a mobile-first approach, meaning your content takes center-stage, regardless of whether your visitors arrive by sm\
artphone, tablet, laptop, or desktop computer.                                                                          
Version: 1.0                                                                                                            
License: GNU General Public License v2 or later                                                                         
License URI: http://www.gnu.org/licenses/gpl-2.0.html                                                                   
Tags: black, blue, gray, pink, purple, white, yellow, dark, light, two-columns, left-sidebar, fixed-layout, responsive-\
layout, accessibility-ready, custom-background, custom-colors, custom-header, custom-menu, editor-style, featured-image\
s, microformats, post-formats, rtl-language-support, sticky-post, threaded-comments, translation-ready                  
Text Domain: twentyfifteen                                                                                              
                                                                                                                        
This theme, like WordPress, is licensed under the GPL.                                                                  
Use it to make something cool, have fun, and share what you've learned with others.                                     
*/
@import url('../twentyfifteen/style.css');

footerのoverride

  • footer.php親テーマから子テーマへコピー
$ cp twentyfifteen/footer.php twentyfifteen-child/
$ emacs twentyfifteen-child/footer.php 
  • footer.phpをoverrideする。(ここではcopyright表記を設定)
twentyfifteen-child/footer.php
<?php
/**                                                                                                                     
 * The template for displaying the footer                                                                               
 *                                                                                                                      
 * Contains the closing of the "site-content" div and all content after.                                                
 *                                                                                                                      
 * @package WordPress                                                                                                   
 * @subpackage Twenty_Fifteen                                                                                           
 * @since Twenty Fifteen 1.0                                                                                            
 */
?>

        </div><!-- .site-content -->

        <footer id="colophon" class="site-footer" role="contentinfo">
                <div class="site-info">
                        <?php
                                /**                                                                                     
                                 * Fires before the Twenty Fifteen footer text for footer customization.                
                                 *                                                                                      
                                 * @since Twenty Fifteen 1.0                                                            
                                 */
                                do_action( 'twentyfifteen_credits' );
                        ?>
                        <a href="<?php echo esc_url( __( 'http://www.fullmarks.co.jp/', 'twentyfifteen' ) ); ?>"><?php \
printf( __( 'COPYRIGHT © %s, FULL MARKS, Inc.', 'twentyfifteen' ), '2015' ); ?></a>
                </div><!-- .site-info -->
        </footer><!-- .site-footer -->

</div><!-- .site -->

<?php wp_footer(); ?>

</body>
</html>
  • 作成した子テーマをWordPressから有効にして、変更完了。

参考

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?