Support » Plugin: Breadcrumb NavXT » ‘Notice : Undefined index: bpost_post_archive_display in’ on arvhive page.

  • This error messages are showed on archive page whose slug is ‘activities’.
    I used my original template(archive.php) and set ‘Posts page” on under ‘Settings > Reading’.

    Notice
    : Undefined index: bpost_post_archive_display in
    C:\xampp\htdocs\test_mature-society\wp-content\plugins\breadcrumb-navxt\class.bcn_breadcrumb_trail.php
    on line
    1105

    Notice
    : Undefined index: bpost_post_archive_display in
    C:\xampp\htdocs\test_mature-society\wp-content\plugins\breadcrumb-navxt\class.bcn_breadcrumb_trail.php

    I am very sorry to trouble you when you’re busy, but I would appreciate your support.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author John Havlik

    (@mtekk)

    Well this is interesting. I can see why an PHP notice would be thrown, I just am not sure how to get a page to actually trigger those conditions. Specifically, I’m not sure why the is_post_type_archive() is returning true for you on the post post type archive (is_home() is the only conditional returning true on my testbed). Is there anything else, code wise, unique about this site (any other plugins or any custom code running on the site)?

    Thread Starter yutananjo

    (@yutananjo)

    Thank you very much for your quick response!

    Actually I am a very beginner of coding a website and might do mistakes.
    (This is my first website making from a scrach.)

    These are my code below.(sorry that there is Japanese comments..)

    archive.php

    <?php get_header(); ?>
      <main>
        <div class="hero-page">
          <div class="hero-page__page-title">
            <p class="hero-page__page-title__en">Activities
            </p>
            <h1 class="hero-page__page-title__ja">活動報告</h1>
          </div>
          <div class="hero-page__img">
            <img />/images/activities/activities__page.jpg" alt="">
          </div>
        </div>
        <?php get_template_part('breadcrumb'); ?>
        <ul class="category-list">
        <?php
          $categories = get_terms( 'category', array(
              'orderby'    => 'name',
              'hide_empty' => 0,
          ) );
          
              foreach($categories as $value):
          ?>
          <li><a>term_id); ?>"><?php echo $value->name;?></a></li>
        <?php endforeach; ?>
        </ul>
        
        <ul class="posts">
        <?php
         $paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1;
          $args = array(
            'post_type'      => 'post',
            'posts_per_page' => 10,
            'paged' => $paged,
          );
          $the_query = new WP_Query( $args );
          if ( $the_query->have_posts() ):
          ?>
          <?php while( $the_query->have_posts() ) : $the_query->the_post(); ?>
          <li class="posts__item effect-fade">
            <a>">
              <div class="posts__thumb">
                <?php the_post_thumbnail(); ?>
                <div class="btn-more">
                  <p class="btn-more__text">More</p>
                  <div class="btn-more__arrow"></div>
                </div>
              </div>
              <div class="posts__title"><?php the_title(); ?></div>
              <div class="posts__meta">
                <time><?php the_time('Y-m-d'); ?></time>
                <?php the_category(); ?>
              </div> 
              </a>
            </li>
            <?php endwhile; ?>
        </ul> 
        <?php if( function_exists("the_pagination") ) the_pagination(); ?>
          <?php wp_reset_postdata(); ?>
          <?php endif; ?>
      </main>
      <div class="btn-top">
        <a href="#">
          <div class="btn-top__inner">
            <div class="btn-top__arrow"></div>
            <p class="btn-top__text">Top</p>
          </div>
        </a>
      </div>
    <?php get_footer(); ?>

    funcitons.php

    <?php
    
    function my_setup() {
    
      // アイキャッチ画像を利用できるようにします。
      add_theme_support( 'post-thumbnails' ); 
      set_post_thumbnail_size( 360, 270, true );
      
      // ヘッダーにfeedのlinkを生成します。
      add_theme_support( 'automatic-feed-links' ); 
    
      // タイトルタグを自動生成します。
      add_theme_support( 'title-tag' ); 
    }
    add_action( 'after_setup_theme', 'my_setup' );
    
    // 読み込むCSSとJavaScriptを設定します。
    function my_script_init() {
      // destyle CSSの読み込み
      wp_enqueue_style( 'destyle-style', get_template_directory_uri().'/css/vendors/destyle.css', array(), '2.0.2' );
    
      // swiper CSSの読み込み
      wp_enqueue_style( 'swiper-style', get_template_directory_uri().'/css/vendors/swiper.min.css', array(), '5.4.5' );
      
      // サイト用CSSの読み込み
      wp_enqueue_style( 'mature-society-style', get_template_directory_uri().'/css/style.css', array(), '1' );
    
      // テーマ定義CSSの読み込み
      wp_enqueue_style( 'wp-style', get_stylesheet_uri(), array(), '1' );
      
      // jQueryの読み込み
      wp_deregister_script( 'jquery' ); // デフォルトで読み込まれるjQueryの登録を抹消
      wp_enqueue_script( 'jquery', get_template_directory_uri().'/js/vendors/jquery-3.5.1.min.js', array(), '1.11.3', true );
    
      // Swiper JS
      wp_enqueue_script( 'swiper-js', get_template_directory_uri() . '/js/vendors/swiper.min.js', array(), '5.4.5', true );
    
      // サイト用JavaScriptの読み込み
      wp_enqueue_script( 'mature-society-script', get_template_directory_uri().'/js/script.js', array(), '1', true );
    }
    add_action( 'wp_enqueue_scripts', 'my_script_init' );
    
      //投稿アーカイブページの作成
    function post_has_archive( $args, $post_type ) {
    
    	if ( 'post' == $post_type ) {
    		$args['rewrite'] = true;
    		$args['has_archive'] = 'activities'; 
        $args['label'] = '活動報告';
    	}
    	return $args;
    
    }
    add_filter( 'register_post_type_args', 'post_has_archive', 10, 2 );
    
    // ページ遷移時のリダイレクトを阻止する
    add_filter('redirect_canonical','my_disable_redirect_canonical');
    function my_disable_redirect_canonical( $redirect_url ) {
    if ( is_single() ){
        //リクエストURLに「/page/」があれば、リダイレクトしない
        preg_match('/\/paged\//', $redirect_url, $matches);
        if ($matches){
            $redirect_url = false;
            return $redirect_url;
        }
    }
    }
    
    // //ページ送り
    function the_pagination() {
      global $the_query;
      if ( $the_query->max_num_pages <= 1 )
        return;
      echo '<nav class="pagination">';
      echo paginate_links( array(
        'base'         => '?paged=%#%',
        'format'       => '?paged=%#%',
        'current'      => max( 1, get_query_var('paged') ),
        'total'        => $the_query->max_num_pages,
        'prev_text'    => '',
        'next_text'    => '',
        'type'         => 'list',
        'end_size'     => 1,
        'mid_size'     => 3,
      ) );
      echo '</nav>';
    }

    I pick up these plugin which seem to have something with this problem.
    ・Custom Post Type Permalinks
    ・Custom Post Type UI

    If we don’t solve it, I am plan to put the breadcrumb html link on archive.php.

    With best regards,

    Thread Starter yutananjo

    (@yutananjo)

    Hi.
    This problem has been solved!!

    After I have made a page(/activities) on admin, the error has gone!!
    I don’t know the reason but it is ok.

    I appreciate for your support.
    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.