質問編集履歴
2
<code>
    
        title	
    CHANGED
    
    | 
            File without changes
         | 
    
        body	
    CHANGED
    
    | @@ -8,6 +8,9 @@ | |
| 8 8 | 
             
            
         | 
| 9 9 |  | 
| 10 10 | 
             
            ----------------category.phpのソース--------------------------------------------------
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            ```ここに言語を入力
         | 
| 13 | 
            +
             | 
| 11 14 | 
             
            <?php get_header(); ?>
         | 
| 12 15 |  | 
| 13 16 | 
             
            <?php
         | 
| @@ -172,4 +175,7 @@ | |
| 172 175 | 
             
                <?php get_sidebar(); ?>
         | 
| 173 176 | 
             
            </div>
         | 
| 174 177 | 
             
            <!--/#content -->
         | 
| 175 | 
            -
            <?php get_footer(); ?>
         | 
| 178 | 
            +
            <?php get_footer(); ?>
         | 
| 179 | 
            +
             | 
| 180 | 
            +
             | 
| 181 | 
            +
            ```
         | 
1
category.phpのソースを追記しました。
    
        title	
    CHANGED
    
    | 
            File without changes
         | 
    
        body	
    CHANGED
    
    | @@ -5,4 +5,171 @@ | |
| 5 5 | 
             
            宜しくお願いします。
         | 
| 6 6 |  | 
| 7 7 | 
             
            ※テーマはAFFINGER5
         | 
| 8 | 
            -
            
         | 
| 8 | 
            +
            
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            ----------------category.phpのソース--------------------------------------------------
         | 
| 11 | 
            +
            <?php get_header(); ?>
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            <?php
         | 
| 14 | 
            +
            $the_cat_id        = get_queried_object_id();
         | 
| 15 | 
            +
            $is_thumbnal_under = (bool) st_get_term_meta( $the_cat_id, 'thumbnail_under' );
         | 
| 16 | 
            +
            $has_thumbnail     = st_has_term_thumbnail();
         | 
| 17 | 
            +
            ?>
         | 
| 18 | 
            +
            <div id="content" class="clearfix">
         | 
| 19 | 
            +
                <div id="contentInner">
         | 
| 20 | 
            +
                    <main>
         | 
| 21 | 
            +
                        <article>
         | 
| 22 | 
            +
            				<?php if ( ! $is_thumbnal_under && $has_thumbnail ): // サムネイル ?>
         | 
| 23 | 
            +
            					<?php get_template_part( 'st-category-eyecatch' ); ?>
         | 
| 24 | 
            +
            				<?php endif; ?>
         | 
| 25 | 
            +
             | 
| 26 | 
            +
            					<!--ぱんくず -->
         | 
| 27 | 
            +
            					<div id="breadcrumb">
         | 
| 28 | 
            +
            					<ol itemscope itemtype="http://schema.org/BreadcrumbList">
         | 
| 29 | 
            +
            						<li itemprop="itemListElement" itemscope
         | 
| 30 | 
            +
                  itemtype="http://schema.org/ListItem"><a href="<?php echo home_url(); ?>" itemprop="item"><span itemprop="name"><?php echo esc_html( $GLOBALS["stdata141"] ); ?></span></a> > <meta itemprop="position" content="1" /></li>
         | 
| 31 | 
            +
             | 
| 32 | 
            +
            					<?php
         | 
| 33 | 
            +
            					$catid = $the_cat_id;
         | 
| 34 | 
            +
            					if( !$catid ){
         | 
| 35 | 
            +
            					$cat_now = get_the_category();
         | 
| 36 | 
            +
            					$cat_now = $cat_now[0];
         | 
| 37 | 
            +
            					$catid  = $cat_now->cat_ID;
         | 
| 38 | 
            +
            					}
         | 
| 39 | 
            +
            					?>
         | 
| 40 | 
            +
            					<?php $allcats = array( $catid ); ?>
         | 
| 41 | 
            +
            					<?php
         | 
| 42 | 
            +
            					while ( !$catid == 0 ) {
         | 
| 43 | 
            +
            						$mycat = get_category( $catid );
         | 
| 44 | 
            +
            						$catid = $mycat->parent;
         | 
| 45 | 
            +
            						array_push( $allcats, $catid );
         | 
| 46 | 
            +
            					}
         | 
| 47 | 
            +
            					array_pop( $allcats );
         | 
| 48 | 
            +
            					$allcats = array_reverse( $allcats );
         | 
| 49 | 
            +
            					?>
         | 
| 50 | 
            +
             | 
| 51 | 
            +
            					<?php 
         | 
| 52 | 
            +
            					$i = 2;
         | 
| 53 | 
            +
            					foreach ( $allcats as $catid ): ?>
         | 
| 54 | 
            +
            							<li itemprop="itemListElement" itemscope
         | 
| 55 | 
            +
                  itemtype="http://schema.org/ListItem"><a href="<?php echo esc_url( get_category_link( $catid ) ); ?>" itemprop="item">
         | 
| 56 | 
            +
            								<span itemprop="name"><?php echo esc_html( get_cat_name( $catid ) ); ?></span> </a> > 
         | 
| 57 | 
            +
            								<meta itemprop="position" content="<?php echo $i; ?>" />
         | 
| 58 | 
            +
            							</li>
         | 
| 59 | 
            +
            					<?php  $i++; ?>
         | 
| 60 | 
            +
            					<?php endforeach; ?>
         | 
| 61 | 
            +
            					</ol>
         | 
| 62 | 
            +
            					</div>
         | 
| 63 | 
            +
            					<!--/ ぱんくず -->
         | 
| 64 | 
            +
                    <?php
         | 
| 65 | 
            +
            		$now_category = get_query_var('cat');
         | 
| 66 | 
            +
            		$args = array(
         | 
| 67 | 
            +
                            'include' => array($now_category),
         | 
| 68 | 
            +
            		);
         | 
| 69 | 
            +
            		$tag_all = get_terms("category", $args);
         | 
| 70 | 
            +
            		$cat_data = get_option('cat_'.$now_category);
         | 
| 71 | 
            +
               
         | 
| 72 | 
            +
            		if(trim($cat_data['listdelete']) === ''){
         | 
| 73 | 
            +
                                 //一覧を表示する場合 ?>
         | 
| 74 | 
            +
                                    <div class="post">
         | 
| 75 | 
            +
                                    <?php if(trim($cat_data['st_cattitle']) !== ''){ ?>
         | 
| 76 | 
            +
                                        <h1 class="entry-title"><?php echo esc_html($cat_data['st_cattitle']) ?></h1>
         | 
| 77 | 
            +
                                    <?php }else{ ?>
         | 
| 78 | 
            +
                                        <h1 class="entry-title"><?php single_cat_title(); ?></h1>
         | 
| 79 | 
            +
                                    <?php } ?>
         | 
| 80 | 
            +
             | 
| 81 | 
            +
            			<?php if ( is_active_sidebar( 21 ) ) { ?>
         | 
| 82 | 
            +
            				<?php if ( function_exists( 'dynamic_sidebar' ) && dynamic_sidebar( 21 ) ) : else : //カテゴリページ上一括ウィジェット ?>
         | 
| 83 | 
            +
            				<?php endif; ?>
         | 
| 84 | 
            +
            			<?php } ?>
         | 
| 85 | 
            +
             | 
| 86 | 
            +
            			<?php if(!is_paged()){ ?>
         | 
| 87 | 
            +
            				<div id="nocopy" <?php st_text_copyck(); ?>>
         | 
| 88 | 
            +
            					<?php if ( $is_thumbnal_under && $has_thumbnail ): // サムネイル ?>
         | 
| 89 | 
            +
            						<?php get_template_part( 'st-category-eyecatch' ); ?>
         | 
| 90 | 
            +
            					<?php endif; ?>
         | 
| 91 | 
            +
             | 
| 92 | 
            +
            					<div class="entry-content">
         | 
| 93 | 
            +
            						<?php echo apply_filters('the_content',category_description()); //コンテンツを表示 ?>
         | 
| 94 | 
            +
            					</div>
         | 
| 95 | 
            +
            				</div>
         | 
| 96 | 
            +
            				<?php get_template_part( 'popular-thumbnail' ); //任意のエントリ ?>
         | 
| 97 | 
            +
            			<?php } ?>
         | 
| 98 | 
            +
             | 
| 99 | 
            +
                                    </div><!-- /post -->
         | 
| 100 | 
            +
             | 
| 101 | 
            +
            			<?php if( category_description() && (!is_paged()) ){ //コンテンツがある場合 ?>
         | 
| 102 | 
            +
            				<?php if ( isset($GLOBALS['stplus']) && $GLOBALS['stplus'] === 'yes' ) {
         | 
| 103 | 
            +
            					get_template_part( 'st-rank' ); //ランキング 
         | 
| 104 | 
            +
            				} ?>
         | 
| 105 | 
            +
            				<?php if( trim($cat_data['snscat'] ) !== '' ):
         | 
| 106 | 
            +
            					get_template_part( 'sns-cat' ); //ソーシャルボタン読み込み
         | 
| 107 | 
            +
            				endif; ?>
         | 
| 108 | 
            +
            				<div class="cat-itiran" style="padding-top:20px;">
         | 
| 109 | 
            +
            			<?php } ?>
         | 
| 110 | 
            +
             | 
| 111 | 
            +
                                    		<?php get_template_part( 'itiran' ); //投稿一覧読み込み ?>
         | 
| 112 | 
            +
                                   			<?php get_template_part( 'st-pagenavi' ); //ページナビ読み込み ?>
         | 
| 113 | 
            +
             | 
| 114 | 
            +
            			<?php if( category_description() && (!is_paged()) ){ //コンテンツがある場合 ?>
         | 
| 115 | 
            +
            				</div>
         | 
| 116 | 
            +
            			<?php }else{
         | 
| 117 | 
            +
            				get_template_part( 'st-rank' ); //ランキング 
         | 
| 118 | 
            +
            			} ?>
         | 
| 119 | 
            +
             | 
| 120 | 
            +
            		<?php }else{ //一覧を表示しない ?>
         | 
| 121 | 
            +
             | 
| 122 | 
            +
                                    <div class="post">
         | 
| 123 | 
            +
                                    <?php if(trim($cat_data['st_cattitle']) !== ''){ ?>
         | 
| 124 | 
            +
                                        <h1 class="entry-title"><?php echo esc_html($cat_data['st_cattitle']) ?></h1>
         | 
| 125 | 
            +
                                    <?php }else{ ?>
         | 
| 126 | 
            +
                                        <h1 class="entry-title">「<?php single_cat_title(); ?>」 一覧</h1>
         | 
| 127 | 
            +
                                    <?php } ?>
         | 
| 128 | 
            +
             | 
| 129 | 
            +
            			<?php if ( is_active_sidebar( 21 ) ) { ?>
         | 
| 130 | 
            +
            				<?php if ( function_exists( 'dynamic_sidebar' ) && dynamic_sidebar( 21 ) ) : else : //カテゴリページ上一括ウィジェット ?>
         | 
| 131 | 
            +
            				<?php endif; ?>
         | 
| 132 | 
            +
            			<?php } ?>
         | 
| 133 | 
            +
                                  
         | 
| 134 | 
            +
            			<div id="nocopy" <?php st_text_copyck(); ?>>
         | 
| 135 | 
            +
            				<?php if ( $is_thumbnal_under && $has_thumbnail ): // サムネイル ?>
         | 
| 136 | 
            +
            					<?php get_template_part( 'st-category-eyecatch' ); ?>
         | 
| 137 | 
            +
            				<?php endif; ?>
         | 
| 138 | 
            +
             | 
| 139 | 
            +
            				<div class="entry-content">
         | 
| 140 | 
            +
            					<?php echo apply_filters('the_content',category_description()); //コンテンツを表示 ?>
         | 
| 141 | 
            +
            				</div>
         | 
| 142 | 
            +
            			</div>
         | 
| 143 | 
            +
            			<?php get_template_part( 'popular-thumbnail' ); //任意のエントリ ?>
         | 
| 144 | 
            +
             | 
| 145 | 
            +
            			<?php if(trim($cat_data['snscat']) !== '' && (category_description())){ //コンテンツがある場合 ?>
         | 
| 146 | 
            +
            				<?php if ( isset($GLOBALS['stplus']) && $GLOBALS['stplus'] === 'yes' ) {
         | 
| 147 | 
            +
            					get_template_part( 'st-rank' ); //ランキング 
         | 
| 148 | 
            +
            				} ?>
         | 
| 149 | 
            +
            				<?php get_template_part( 'sns-cat' ); //ソーシャルボタン読み込み ?>
         | 
| 150 | 
            +
            			<?php } ?>
         | 
| 151 | 
            +
             | 
| 152 | 
            +
                                    </div><!-- /post -->
         | 
| 153 | 
            +
            		<?php } ?>
         | 
| 154 | 
            +
             | 
| 155 | 
            +
            		<?php if((trim($cat_data['snscat']) !== '') && (!category_description())){ //コンテンツがない場合 ?>
         | 
| 156 | 
            +
            			<?php if ( isset($GLOBALS['stplus']) && $GLOBALS['stplus'] === 'yes' ) {
         | 
| 157 | 
            +
            				get_template_part( 'st-rank' ); //ランキング 
         | 
| 158 | 
            +
            			} ?>
         | 
| 159 | 
            +
            			<?php get_template_part( 'sns-cat' ); //ソーシャルボタン読み込み ?>
         | 
| 160 | 
            +
            		<?php } ?>
         | 
| 161 | 
            +
             | 
| 162 | 
            +
             | 
| 163 | 
            +
            			<?php if ( is_active_sidebar( 22 ) ) { ?>
         | 
| 164 | 
            +
            				<?php if ( function_exists( 'dynamic_sidebar' ) && dynamic_sidebar( 22 ) ) : else : //カテゴリページ下一括ウィジェット ?>
         | 
| 165 | 
            +
            				<?php endif; ?>
         | 
| 166 | 
            +
            			<?php } ?>
         | 
| 167 | 
            +
             | 
| 168 | 
            +
                        </article>
         | 
| 169 | 
            +
                    </main>
         | 
| 170 | 
            +
                </div>
         | 
| 171 | 
            +
                <!-- /#contentInner -->
         | 
| 172 | 
            +
                <?php get_sidebar(); ?>
         | 
| 173 | 
            +
            </div>
         | 
| 174 | 
            +
            <!--/#content -->
         | 
| 175 | 
            +
            <?php get_footer(); ?>
         | 
