나는 이미지의 설명을 표시이 코드를 수정했습니다워드 프레스 이미지 설명 링크
function the_post_thumbnail_caption() {
global $post;
$thumbnail_id = get_post_thumbnail_id($post->ID);
$thumbnail_image = get_posts(array('p' => $thumbnail_id, 'post_type' => 'attachment'));
if ($thumbnail_image && isset($thumbnail_image[0])) {
echo '<p>'.$thumbnail_image[0]->post_content.'</p>';
}
}
내가 클릭 한 후 팝업 창에서 이미지의 설명을 표시하는 방법에 필요한 것은. 내가 뭘 놓치고 있니? 어떤 도움을 많이 주시면 감사하겠습니다! 감사!
파일은 다음과 같이 진행됩니다
<?php get_header(); ?>
<div id="primary">
<!-- <div id="content" role="main"> -->
<!--</div><!-- #content -->
<?php if($_SERVER['REQUEST_URI'] == '/wordpress/?page_id=5'): ?>
<!--<div style="float:right">-->
<div style="width:640px; float:left;min-height:290px;word-wrap: break-word">
<?php
$myposts = get_posts('');
foreach($myposts as $post) :
setup_postdata($post);
?>
<div class="post-item">
<div class="post-info">
<h2 class="post-title">
<!--<a href="<?php //the_permalink() ?>" title="<?php //the_title_attribute(); ?>"><?php //the_title(); ?></a>-->
<b><?php the_title(); ?></b>
</h2>
<!--<p class="post-meta">Posted by <?php the_author(); ?></p>-->
</div>
<div class="post-content">
<?php the_content(); ?>
<div style="margin:25px 0px;border:1px dotted #ccc; width: 640px;"></div>
</div>
</div>
<?php //comments_template(); ?>
<?php endforeach; wp_reset_postdata(); ?>
</div>
<div style="float:left; width:319px; min-height:200px; border-left:1px solid #ccc">
<div style="float:left; margin-left:5px">
<h2 style="font-family:Mybold; font-size:14pt">Categories</h2>
<?php
the_post_thumbnail_caption();
$categories = get_categories();
foreach ($categories as $cat) {
$category_link = get_category_link($cat->cat_ID);
?><p><a href="<?php echo esc_url($category_link); ?>" title="Category Name"><?php if($cat->parent < 1) echo $cat->cat_name; //echo $cat->category_nicename; ?></a></p><?php ;
}
?>
</div>
</div>
<?php endif;?>
</div><!-- #primary -->
<?php get_footer(); ?>
이미지를 포함하는 각 단락에 대해 생성되는 최종 html을 게시 할 수 있습니까? – Raad
방금 파일을 게시했습니다. –
그건 원시 PHP + HTML입니다. 최종 HTML을 실제로 찾고있었습니다. 즉 브라우저에서 HTML이 어떻게 보이는지 확인할 수있었습니다. – Raad