Breadcrumb NavXTのfunctions.phpを使ったカスタマイズ方法

functions.php でカスタム投稿newsの一覧の時だけカスタマイズし、2番目のパンくずを消しています。

 

パンくずの指定はこのようになっています。

ホーム > 親ページ > 投稿ページ > あいうえお

$bcnObj->trail[3] > $bcnObj->trail[2] > $bcnObj->trail[1] > $bcnObj->trail[0]

 

 

functions.php

add_action('bcn_after_fill', 'foo_pop');
function foo_pop($trail){

  if( is_post_type_archive('news') ){
    if(!is_date()){
      unset( $trail->trail[1] );
    }
 
  }
}


add_action('bcn_after_fill', 'change_link');
 
function change_link($trail){
  if( is_post_type_archive('news') ){
    if(!is_date()){
      $new_item = new bcn_breadcrumb( 'パンくずの名前', '<a title="%ftitle%." href="%link%">%htitle%</a>', array('external-link'), 'https://webcreators.me/blog/926/') ;
      $trail->trail[1] = $new_item;
    }
  }
}

 

参考サイト:

 

https://tenman.info/labo/snip/archives/3761

 

https://accelboon.com/tn/breadcrumb-navxt-%E3%81%A7%E7%8B%AC%E8%87%AA%E3%81%AE%E9%A0%85%E7%9B%AE%E3%82%92%E8%BF%BD%E5%8A%A0%E3%81%99%E3%82%8B/

 

 

 

 

 

 

 

category cloud