LoginSignup
0
0

More than 5 years have passed since last update.

WordPressのループ回数を取得してクラス名に付加する方法

Posted at

fanction.phpに入力

fanction.php
//ループ回数を取得
function loopNumber(){
global $wp_query;
return $wp_query->current_post+1;
}

やり方

<?php echo loopNumber(); ?>

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0