0

php初心者です。
content/work/sample-work1/ を見るようになっているのを

content/yyyy/mm/dd/news01/ を見れるよう変更したいです。
その場合、どこをどう直せばよいのでしょうか。

<?php
$options = get_design_plus_option();
$show_category = $options[ 'show_work_list_category' ];
$query = new WP_Query('post_type=work&posts_per_page=9');
if ( $query->have_posts() ):
?>
<div class="information">
  <h2 class="en">INFORMATION</h2>
  <ul>
    <?php
    $counter = 1;
    while ( $query->have_posts() ): $query->the_post();

    // サムネイル画像の取得
    if ( has_post_thumbnail() ) {
      $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'size1' );
    } elseif( $options[ 'no_image2' ] ) {
      $image = wp_get_attachment_image_src( $options['no_image1'], 'full' );
    } else {
      $image = array();
      $image[0] = esc_url( get_bloginfo('template_url') ) . "/img/common/no_image1.gif";
    }
    ?>

    <?php
    // 4つ目以上の場合は、sp_noneクラスを付与
    if ( $counter > 3 ):
    ?>
    <li class="sp_none">
      <?php else: ?>
    <li>
      <?php endif; ?>
      <a href="<?php the_permalink(); ?>">
        <figure>
          <?php
          // カテゴリを取得表示
          if ( $show_category ):
            $area_category = get_the_terms( $post->ID, 'area' );
            if ( $area_category && !is_wp_error( $area_category ) ):
          ?>
          <time class="en"><?php echo esc_html( $area_category[ 0 ]->name ); ?></time>
          <?php
            endif;
          endif;
          ?>
          <img src="<?php echo esc_attr( $image[0] ); ?>" alt="">
          <figcaption><?php the_title(); ?></figcaption>
        </figure>
      </a>
    </li>
    <?php
    $counter++;
    endwhile;
    ?>
  </ul>
  <div class="btn en"><a class="block" href="./content/information/">MORE</a></div>
</div>
<?php
wp_reset_postdata();
endif;
?>
2
  • 質問の範囲が広く説明が長文になってしまいそうな気配がある質問で、回答が付きづらい印象です。 おそらく何を手を付けてよいのかわからないのかと思いますが、とはいえ一気に回答に向かうのは難しいそうです。まずはWP_Queryを使ってルーティングの変更をしてみるというのを試してみてわからないことがあれば追加で質問してみてはいかがでしょうか?
    – keitaro_so
    2020年5月18日 1:30
  • またWordPressの様々な学習方法はいろいろネットに落ちているのでその辺を駆使して一通り目を通してから再度取り組むのも手かと思います。
    – keitaro_so
    2020年5月18日 1:31

0

この質問に回答するには、ログインする必要があります。

のタグが付いた他の質問を参照する。