私はカスタムWordPressテーマである108.179.217.161に取り組んでおり、ホームページにスライダーを設定しています。ただし、個々のページでは、注目の画像を実際のメイン画像として使用し、ホームページのローテーターを使用したいと思います。
ローテーター用のウィジェットを備えたウィジェットエリアを使用しており、ページがホームページでない場合はifステートメントを使用して区別していますが、画像が正しくレンダリングされていません。108.179.217.161/contact-us/を参照してください。
以下は私のコードです:
<div id="slider" style="position:relative;height:679px;width:100%;">
<!--<img width=1228 src="<?php bloginfo(template_url)?>/images/room-slider.png" alt="" style="position:absolute;z-index:-20;width:100%;height:679px;"/>-->
<div style="position:absolute;z-index:-20;width:100%;height:679px;overflow:hidden;">
<?php if (is_page('Home')) {?>
<?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Rotator')) : ?>
[ do default stuff if no widgets ]
<?php endif; ?>
<? } else {
$thumb = get_post_meta($post->ID,'_thumbnail_id',false);
$thumb = wp_get_attachment_image_src($thumb[0], 'header', false);
$thumb = $thumb[0];
echo "<img src='$thumb' alt='' style='position:relative;z-index:1;width:1621px;height:679px;'";
}?>
</div>