初心者です、拙い説明で申し訳ございません。ご教授いただければ幸いです。
public static function get_html() <?php $args = array(省略); $posts = get_posts($args); ===================================> <?php if ($posts) : foreach ($posts as $post) : setup_postdata($post); ?> <h1><?= $post->post_title ?></h1> <p>テスト</p> <?php endforeach; ?> <=================================== wp_reset_postdata(); ?>
こうなっているphpがあり、===================================の間をhtmlとしてreturnしたいです。
get_htmlを呼び出した時に、htmlとして呼び出せればいいです。
どのようなやり方がありますか?
wordpress 5.5.3
Web サーバー Apache/2.4.53 ()
PHP バージョン 7.4.28
回答3件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2022/07/07 07:22