2

カスタム wordpress ウィジェットでサムネイル画像を取得するための php の行があります。

$footer_recent_thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'footer-recent-thumbnail' );

2 つの php エラーが生成されます。

NOTICE: customwidgets.php:75 - Undefined variable: post
NOTICE: customwidgets.php:75 - Trying to get property of non-object

どうすればこれを解決できますか? ブログのサムネイルを取得するために使用するのと同じphpであり、エラーは発生しません。

4

2 に答える 2