我打電話圖像轉換成single.php
用下面的代碼添加CSS全元添加到WordPress的圖像
的single.php
<? if(has_post_thumbnail($post_id)): ?>
<div class="post-image">
<img src="<?=wp_get_attachment_url(get_post_thumbnail_id()); ?>">
</div>
<? endif; ?>
的問題是,我現在發現,元數據當我點擊編輯媒體沒有顯示時,通過CMS端添加。
有誰知道如何將它們編碼到我的single.php中?
我完全的single.php
<?php get_header(); ?>
<? if(has_post_thumbnail($post_id)): ?>
<div class="single-featured-image post-image">
<h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
<img src="<?=wp_get_attachment_url(get_post_thumbnail_id()); ?>">
</div>
<? endif; ?>
<img src="<?php echo $url; ?>" />
<div class="blog-post">
<?php
if (have_posts()) : while (have_posts()) : the_post();
get_template_part('content-single', get_post_format());
if (comments_open() || get_comments_number()) :
comments_template();
endif;
endwhile; endif;
?>
</div>
</div> // closes of container
<?php get_footer(); ?>
你想要展示什麼「元」?是不是你失去了它,而是你根本沒有顯示。 – yivi
標題說明和alt –