wordpressでsmart custom fieldsを使用しているのですが、
固定ページでは、SCF::get()で値を取得していた物を
function.phpファイル内で操作したいと考えています。
function.phpファイル内にSCF::get()を記述しても、
NULLが返ってくるだけで値が取得でしません。
どの様にしたらfunction.phpでsmart custom fieldsの値が取得できるのでしょうか?
何卒よろしくお願いいたします。
現状:
function.php内
<?php $args = array( 'numberposts' => 5, 'post_type' => 'calendar', 'posts_per_page' => -1, 'date_query' => array( array( 'year' => $today_year, 'month' => $today_month, ), ), ); $customPosts = get_posts($args); if($customPosts) : foreach($customPosts as $post) : setup_postdata( $post ); $scf_text = SCF::get('scf_text'); //値が取得出来ない。。。 ?> <?php endforeach; ?> <?php else : ?> <p>イベントはありません。</p> <?php endif; wp_reset_postdata(); ?>

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2022/04/20 04:13