我只想在主页/博客上显示第二幅特色图片。
插件如下:http://wordpress.org/support/plugin/dynamic-featured-image
开发人员告诉我,我可以这样做:
<?php
if( class_exists(\'Dynamic_Featured_Image\') ) {
global $dynamic_featured_image;
$featured_images = $dynamic_featured_image->get_featured_images( get_the_ID() );
//If you want to display all featured images you can loop through the image to display them as required
foreach( $featured_images as $image ) {
echo "<a href=\'{$image[\'full\']}\'>";
echo "<img src=\'{$image[\'thumb\']}\' alt=\'Dynamic Featured Image\' />";
echo "</a>";
}
//if you only want to show 2nd featured image you can do
if (isset($featured_images[0])) {
$image = $featured_images[0];
echo "<a href=\'{$image[\'full\']}\'>";
echo "<img src=\'{$image[\'thumb\']}\' alt=\'Dynamic Featured Image\' />";
echo "</a>";
}
}
有人能帮我做这件事吗。我是否需要在函数中添加一些内容。php或如何?提前谢谢。
请查看此链接,我与开发人员的讨论:https://wordpress.org/support/topic/how-to-show-only-2nd-featured-img-on-homeblog?replies=4