WordPress の RSS はデフォルトではコンテンツ部分しか表示されません。もしあなたがカスタムフィールドを使って追加の情報を入力して、テーマをカスタマイズして記事側で表示するようにしても、RSS 側には反映されません。
もし RSS にもカスタムフィールドの値を表示するようにしたい場合は下記の方法で表示することができます。
1 2 3 4 5 6 7 8 9 10 11 12 | function fields_in_feed($content) { if(is_feed()) { $post_id = get_the_ID(); $output = '<div class="bottom">'; $output .= '<p><strong>今日の一言:</strong> ' . get_post_meta($post_id, 'message', true) . '</p>'; $output .= '<p><strong>明日の予告:</strong> ' . get_post_meta($post_id, 'next', true) . '</p>'; $output .= '</div>'; $content = $content.$output; } return $content; } add_filter('the_content','fields_in_feed'); |
これは add_filter の the_content を使ってカスタムフィールドの値を呼び出し、コンテンツの中に追加する形で実装しています。この方法は下記のページで紹介されていたものを参考にしました。
コメント