子テーマの設定について
-
WpTHKというテーマを使おうと思っているのですが、このテーマには子テーマが設定されていて
親テーマのsingle.phpには下記の記載があります。
———————————–
<?php
/**
* WpTHK WordPress Theme – free/libre wordpress platform
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* @copyright Copyright (C) 2015 Thought is free.
* @license http://www.gnu.org/licenses/gpl-2.0.html GPL v2 or later
* @author LunaNuko
* @link http://thk.kanzae.net/
* @translators rakeem( http://rakeem.jp/ )
*/if( $wpthk[‘breadcrumb_view’] === ‘inner’ ) get_template_part( ‘breadcrumb’ ); ?>
<article>
<div id=”post-<?php the_ID(); ?>” <?php post_class(‘post’); ?>>
<?php
if( function_exists(‘dynamic_sidebar’) === true && is_active_sidebar(‘post-title-upper’) === true ) {
dynamic_sidebar( ‘post-title-upper’ );
}if( have_posts() === true ) {
while( have_posts() === true ) {
the_post();
?>
<h1 class=”entry-title”><?php the_title(); //タイトル ?></h1>
<?php
get_template_part(‘meta’);
if( isset( $wpthk[‘sns_tops_enable’] ) ) {
$sns_layout = ‘tops’;
get_template_part(‘sns’); // SNS 記事上
}
if( function_exists(‘dynamic_sidebar’) === true && is_active_sidebar(‘post-title-under’) === true ) {
dynamic_sidebar( ‘post-title-under’ );
}
the_content(); // 本文
?>
<div class=”clearfix”></div>
<div class=”meta-box”>
<?php
thk_link_pages();
$meta_under = true;
get_template_part(‘meta’);
if( isset( $wpthk[‘author_visible’] ) ) {
if( $wpthk[‘author_page_type’] === ‘auth’ ) {
?>
<p class=”vcard author”><i class=”fa fa-pencil”></i>Posted by <span class=”fn”>“><?php the_author(); ?></span><?php edit_post_link( __( ‘Edit This’, ‘wpthk’ ), ‘ (‘, ‘) ‘ ); ?></p>
<?php
}
else {
?>
<p class=”vcard author”><i class=”fa fa-pencil”></i>Posted by <span class=”fn”>“><?php the_author(); ?></span><?php edit_post_link( __( ‘Edit This’, ‘wpthk’ ), ‘ (‘, ‘) ‘ ); ?></p>
<?php
}
}
?>
</div>
<?php if( isset( $wpthk[‘sns_bottoms_enable’] ) || isset( $wpthk[‘adsense_visible’] ) ) echo ‘<hr />’; ?>
</div><!–/post–>
<aside>
<?php
if( isset( $wpthk[‘adsense_visible’] ) ) get_template_part(‘adsense’); // アドセンスif( isset( $wpthk[‘sns_bottoms_enable’] ) ) {
?>
<h2 class=”sns-msg”><?php echo $wpthk[‘sns_bottoms_msg’]; ?></h2>
<?php
$sns_layout = null;
get_template_part(‘sns’); // SNS 記事下
}
}
}
else {
?>
<p><?php echo __( ‘No posts yet’, ‘wpthk’ ); ?></p>
<?php
}
?>
<!–nav–>
<div class=”pnavi”>
<?php
$next_post = get_next_post();
if( $next_post ) {
$next_thumb = get_the_post_thumbnail($next_post->ID, ‘thumb100’);
if( empty( $next_thumb ) ) $next_thumb = ‘<div class=”no-img-next”><i class=”fa fa-sticky-note-o”></i></div>’;
?>
<div class=”next”><?php next_post_link( ‘%link’, $next_thumb . ‘<div class=”ntitle”>’ . $next_post->post_title . ‘</div><div class=”next-arrow”><i class=”fa fa-arrow-right pull-right”></i>Next</div>’ ); ?></div>
<?php
}
else {
?>
<div class=”next”>“><i class=”fa fa-home navi-home”></i><div class=”next-arrow”><i class=”fa fa-arrow-right fa-2x pull-right”></i>Home</div></div>
<?php
}$prev_post = get_previous_post();
if( $prev_post ) {
$prev_thumb = get_the_post_thumbnail($prev_post->ID, ‘thumb100’);
if( empty( $prev_thumb ) ) $prev_thumb = ‘<div class=”no-img-prev”><i class=”fa fa-file-text-o”></i></div>’;
?>
<div class=”prev”><?php previous_post_link( ‘%link’, $prev_thumb . ‘<div class=”ptitle”>’ . $prev_post->post_title . ‘</div><div class=”prev-arrow”><i class=”fa fa-arrow-left pull-left”></i>Prev</div>’ ); ?></div>
<?php
}
else {
?>
<div class=”prev”>“><i class=”fa fa-home navi-home”></i><div class=”prev-arrow”><i class=”fa fa-arrow-left fa-2x pull-right”></i>Home</div></div>
<?php
}
?>
</div><!–/pnavi–>
<!–/nav–>
<?php
if( isset( $wpthk[‘related_visible’] ) ) {
?>
<h2 class=”related”><i class=”fa fa-th-list”></i><?php echo __( ‘Related Posts’, ‘wpthk’ ); ?></h2>
<?php
get_template_part(‘related’);
}if( isset( $wpthk[‘comment_visible’] ) ) {
if( comments_open() === true || get_comments_number() > 0 ){
ob_start();
comments_template();
$contents = ob_get_clean();
$contents = preg_replace( ‘/\n+\s*</’, “\n”.'<‘, $contents );
$contents = preg_replace( ‘/>\s+\n/’, ‘>’.”\n”, $contents );
$contents = preg_replace( ‘/>\\s+?</’, ‘><‘, $contents );
echo $contents;
}
}if( isset( $wpthk[‘trackback_visible’] ) && pings_open() === true ) {
?>
<div id=”trackback”>
<h3 class=”tb”><i class=”fa fa-reply-all”></i><?php echo __( ‘TrackBack URL’, ‘wpthk’ ); ?></h3>
<input type=”text” name=”trackback_url” size=”60″ value=”<?php trackback_url() ?>” readonly=”readonly” class=”trackback-url” tabindex=”0″ accesskey=”t” />
</div>
<?php
}
?>
</aside>
</article>
</div><!–/#core–>
</div><!–/#contents–>
</main>
</div><!–/#main–>
<?php if( isset( $wpthk[‘column3’] ) && $wpthk[‘column3’] === ‘3column’ && $wpthk[‘column3_style’] === ‘left’ ) thk_sidebar(‘col3’); ?>
<?php thk_sidebar(); ?>
<?php if( isset( $wpthk[‘column3’] ) && $wpthk[‘column3’] === ‘3column’ && $wpthk[‘column3_style’] === ‘right’ ) thk_sidebar(‘col3’); ?>
</div><!–/#primary–>
<?php thk_footer(); ?>
———————————–single.phpを子テーマに新たに作って、そこに
<?php if(has_tag(‘alc’)){
include(TEMPLATEPATH . ‘/single4.php’);
}
else if(is_mobile()){
include(TEMPLATEPATH . ‘/single2.php’);
}
else{
include(TEMPLATEPATH . ‘/single1.php’);
}
?>
という条件だけ記載して、single1.php、single2.php、single4.php(これらは親single.phpの内容をカスタマイズしたもの)を出力することは出来ないでしょうか。子テーマのsingle.phpに条件だけを記載して置いてみたのですが何も出力されません。
また、親テーマにあるincというフォルダ内にあるwidget.phpというファイルを子テーマにも同じフォルダ構成にして内容を書き換えたものを置いたのですが、これも何も変化がありません。
やり方が間違っているのでしょうか。色々な検索してみたのですが、解決方法が分からず困っています。
お分かりになる方がいましたら、ご指導いただけると幸いです。
- トピック「子テーマの設定について」には新たに返信することはできません。