我想用自定義字段爲WordPress有在這裏我的網站不同的標題橫幅是我的代碼:WordPress的自定義字段
<?php
get_header(); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div id="BodyWrap">
<!--MAIN CONT-->
<div id="mainCont">
<?php get_sidebar(); ?>
<div id="rotateBanner"><?php
// check for image
$image = get_post_meta($post->ID, 'image', $single = true);?>
<img class="mainImg" src="<?php bloginfo(template_url); echo $image; ?>" alt=""/>
</div>
<div id="mainCopy">
<div id="content">
<h2><?php single_post_title(); ?></h2>
<?php the_content('<p class="serif">Read the rest of this page »</p>'); ?>
<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
</div>
</div>
</div>
</div>
<?php endwhile; endif; ?>
<?php get_footer(); ?>
現在的代碼將呈現,但由於某種原因,它只是呈現IMG路徑如:
<img alt="" src="http://www.testground.idghosting.com/philcom/wp-content/themes/phil"/>
here是我把這個自定義字段的demosite
:圖像 因爲我把這個值:/images/sampleHead.png