ID, 'large' );
if ( $thumb ) {
$content = '
 . ')
' . $content;
}
return $content;
}
/**
* カテゴリーリストのカスタマイズ
*/
add_action( 'wp_list_categories', __NAMESPACE__ . '\hook_wp_list_categories', 10, 2 );
function hook_wp_list_categories( $output, $args ) {
// walker指定された特殊なリストには何もしない
// if ( isset( $args['walker'] ) ) return $output;
if ( apply_filters( 'arkhe_move_post_count_into_a', true, 'wp_list_categories' ) ) {
// 投稿数をの中に移動
$output = preg_replace( '/<\/a>\s*\((\d+)\)/', ' ($1)', $output );
}
if ( ! $args['hierarchical'] ) return $output;
// memo: ul を含む li
// $regex = '/]*>(?:(?!<\/li>).)* )、liにクラスを追加してトグルボタンを追加
// (?: )→グループ化するが、キャプチャしない。
// (?!<\/a>). → が続かない任意の文字列
// (?:(?!<\/a>).)* → が続かない任意の文字列を0回以上繰り返す
$regex = '/- \s*().)*)<\/a>\s*
';
return '- ' . $a_tag . '
)、トグルボタンを追加
* ブロックの方にフックが効かないので、サブメニューのアコーディオン化はしない
*/
// add_action( 'wp_list_pages', __NAMESPACE__ . '\hook_wp_list_pages' );
// function hook_wp_list_pages( $output ) {
// $output = preg_replace(
// '/<\/a>([^<]*)の中に置換
*/
add_action( 'get_archives_link', __NAMESPACE__ . '\hook_get_archives_link', 10, 6 );
function hook_get_archives_link( $link_html, $url, $text, $format, $before, $after ) {
if ( ! apply_filters( 'arkhe_move_post_count_into_a', true, 'get_archives_link' ) ) return $link_html;
if ( 'html' === $format ) {
$after = str_replace( ' ', '', $after );
$link_html = '- ' . $before . '' . $text . '' . $after . '
';
}
return $link_html;
}
/**
* カテゴリーチェック時、順番をそのままに保つ
*/
add_action( 'wp_terms_checklist_args', __NAMESPACE__ . '\hook_terms_checklist_args', 10 );
function hook_terms_checklist_args( $args ) {
$args['checked_ontop'] = false;
return $args;
}
/**
* ページネーションの構造を書き換える
*/
add_filter( 'navigation_markup_template', __NAMESPACE__ . '\hook_navigation_markup', 10, 2 );
function hook_navigation_markup( $template, $class ) {
if ( 'pagination' === $class ) {
return '';
}
return $template;
}