情報を追記している場合はありますが、古い情報を訂正はしていませんので、公開年月日を参照してください。プラグイン・タグ、いずれもワードプレス・PHPのバージョン等によって動作しない場合もあります。
previous_posts_link、next_posts_link にクラスをつける。
add_filter( 'previous_posts_link_attributes', 'add_prev_posts_link_class' );
function add_prev_posts_link_class() {
return 'class="page-btn prev"';
}
add_filter( 'next_posts_link_attributes', 'add_next_posts_link_class' );
function add_next_posts_link_class() {
return 'class="page-btn next"';
}
previous_post_link、next_post_link にクラスをつける。
function add_class_previous_post_link($html){
$html = str_replace('<a','<a class="page-btn prev"',$html);
return $html;
}
add_filter('previous_post_link','add_class_previous_post_link',10,1);
function add_class_next_post_link($html){
$html = str_replace('<a','<a class="page-btn next"',$html);
return $html;
}
add_filter('next_post_link','add_class_next_post_link',10,1);