Oh I am stumped here!

I am building a new theme in Wordpress using a BLANK-Theme using Windows xampp.

Built new page home.php and copied index.php over to home.php then added html from my mockup. All appeared fine including images which I have placed directly in htdocs wp folder.

Products/P20obverse.PNG

Built new page and copied index.php over to products.php, edited for correct content, then in WP created page titled My Products and added 4 custom fields. Coded products.php to extract the values and all appear fine except the image value shows nothing.

Copied images from wp main folder to BLANK-Theme/images/Products
still no image appears nor does a broken image icon.

Custom Field
Name=image_test
Value=images/Products/P20obverse.PNG

Tested php code using echo $image and it prints the custom field value out correctly as

images/Products/P20obverse.PNG

... yet I cannot get an image to appear on my products.php.

Opened product.php in browser and copied link location of the broken image link.

file:///C:/xampp/htdocs/mydomain/wp-content/themes/BLANK-Theme/%3C?php%20echo%20get_post_meta($post-%3EID,%20%27image_test%27,%20true);%20?%3E

<?php

/* 

	Template Name: Product Page

*/

?>

<?php get_header(); the_post(); ?>

<div id='main-content'>

	<h1> Buy</h1>
<h2 class="product-title"><?php the_title(); ?></h2>	


<div class="product-box">
        <img class="image" src="<?php echo get_post_meta($post->ID, 'image_test ', true); ?>" />  

		<ul>

        <li><h5>Price</h5> $<?php echo get_post_meta($post->ID, 'price', true); ?></li>
        <li><h5>Product Code</h5> <?php echo get_post_meta($post->ID, 'product_code', true); ?></li>
        <li><h5>Dimensions</h5> <?php echo get_post_meta($post->ID, 'dimensions', true); ?></li>
        <li><a class="button" href="#">Add to Cart</a></li>
    </ul>
</div>

<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>



</div> <!-- END main-content -->



<?php get_sidebar(); ?>

<?php get_footer(); ?>

Anyone here have a similar problem like this?

    Write a Reply...