LoginSignup
3
0

More than 5 years have passed since last update.

[WordPress]foreach内でget_template_partがうまく機能しない

Last updated at Posted at 2018-05-17

概要

<?php get_template_part( $slug, $name ); ?>

これだと変数に値を読み込んでくれないなどの問題が発生した。

関数リファレンス/get template part

解決策

<?php include( locate_template( './slug-name.php' ) ); ?>

これに置き換えたらどうにかなった。

参考

get_template_part in a foreach loop and access to a var of item

3
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
3
0