フォーラム
投稿一覧でカスタムフィールドを入れるなど投稿タイプの条件分岐でカスタマイズがしたい
質問Reopen
お世話になっております。
sng_card_linkをfilterして以下のようなプログラムを子テーマのfunctions.phpを書くことで可能です。
add_filter('sng_card_link', function($html, $id) {
$field = get_post_meta($id, 'field_name');
// ここでカスタムフィールドを使った処理
return $html; // ☜最終的に加工したHTMLを返す。
}, 10, 2);
よろしくお願いします。

<div class="catpost-cards catpost-cards--column-2 catpost-cards--column-mobile-1"> <div class="c_linkto_wrap">
<a class="c_linkto" href="http://localhost:10004/2023/07/14/importance-of-continuous-learning/">
<span class="c_linkto_img_wrap"><img decoding="async" loading="lazy" src="http://localhost:10004/wp-content/uploads/2023/07/mesh-937-1-520x300.png" alt="Importance of continuous learning" width="520" height="300"></span>
<div class="c_linkto_text">
Importance of continuous learning <time class="pubdate sng-link-time dfont" itemprop="datePublished" datetime="2023-07-14">2023年7月14日</time> </div>
</a>
</div>
<p>今日の天気: aaa</p> <div class="c_linkto_wrap">
<a class="c_linkto" href="http://localhost:10004/2023/07/14/hello-everyone/">
<span class="c_linkto_img_wrap"><img decoding="async" loading="lazy" src="http://localhost:10004/wp-content/uploads/2023/07/mesh-937-1-520x300.png" alt="Hello, everyone" width="520" height="300"></span>
<div class="c_linkto_text">
Hello, everyone <time class="pubdate sng-link-time dfont" itemprop="datePublished" datetime="2023-07-14">2023年7月14日</time> </div>
</a>
</div>
<div class="c_linkto_wrap">
<a class="c_linkto" href="http://localhost:10004/2023/07/14/hello-this-is-sample/">
<span class="c_linkto_img_wrap"><img decoding="async" loading="lazy" src="http://localhost:10004/wp-content/uploads/2023/07/mesh-937-1-520x300.png" alt="Hello, This is sample" width="520" height="300"></span>
<div class="c_linkto_text">
Hello, This is sample <time class="pubdate sng-link-time dfont" itemprop="datePublished" datetime="2023-07-14">2023年7月14日</time> </div>
</a>
</div>
<div class="c_linkto_wrap">
<a class="c_linkto" href="http://localhost:10004/2023/05/03/hello-world/">
<span class="c_linkto_img_wrap"><img decoding="async" loading="lazy" src="http://localhost:10004/wp-content/uploads/2023/07/mesh-937-1-520x300.png" alt="Hello world!" width="520" height="300"></span>
<div class="c_linkto_text">
Hello world! <time class="pubdate sng-link-time dfont" itemprop="datePublished" datetime="2023-05-03">2023年5月3日</time> </div>
</a>
</div>
</div>
このような構造です。 <div class="c_linkto_wrap">の中に要素を追加するようにしたい

コメントするには
ユーザー登録が必要です
ユーザー登録が必要です