WordPress 페이지에서 헤더의 배경 이미지로 게시물 이미지가 있습니다. 여기가 해결 방법은 다음과 같습니다WordPress 게시 이미지 변경시 호버 (ACF?)
<?php if (has_post_thumbnail($post->ID)): ?>
<?php $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full'); ?>
<?php else : ?>
<?php endif; ?>
<header class="header" role="banner" itemscope itemtype="http://schema.org/WPHeader" style="background-image: url('<?php echo $image[0]; ?>')">...</div>
은 내가 지금 원하는 것은 호버에 표시해야한다 포스트 (고급 사용자 정의 필드 ??)에 두 번째 이미지를 추가 할 수 있습니다. 이것을 어떻게 할 수 있습니까?
하지 모든 헤더 이미지가 호버에 대한 두 번째 이미지를 가지고 있기 때문에
편집, 나는 "정상"및 "가져가"라고 2 개 사용자 정의 필드를 만들었습니다. 게시물에 게시 이미지가있는 경우 '정적'헤더이고, 게시 이미지가없는 경우 '정상'및 '마우스 오버'가 표시됩니다.
<?php if (has_post_thumbnail($post->ID)): ?>
<?php $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full'); ?>
<header class="header" role="banner" itemscope itemtype="http://schema.org/WPHeader" style="background-image: url('<?php echo $image[0]; ?>')">
<?php else : ?>
<header class="header" role="banner" itemscope itemtype="http://schema.org/WPHeader" style="background-image: url('<?php the_field('normal'); ?>');">
<?php endif; ?>
내가 지금 필요한 것은 호버 나의 두 번째 이미지, "가져가"를 얻을 것입니다 ...
의견을 보내 주셔서 감사합니다. 하지만이 이미지를 가리 키도록 지정해야하는 위치는 어디입니까? PHP로 할 수 있습니까? 내 지식은 조금 제한되어 있습니다. – Irene