hakimjaya06 / carrington

Automatically exported from code.google.com/p/carrington
0 stars 0 forks source link

<img src="<?php echo get_post_meta($post->ID, "thumb", $single = true); ?> "/> don't work #11

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. <?php echo get_post_meta($post->ID, "thumb", $single = true); ?> "/> 
inserted into excerpt-
default.php
2. enter thumb and http link to graphic, in post item custom fields.
3.

What is the expected output?  
<img src="http://thumbimage/example.jpg "/>

What do you see instead?

<img src=" ">

What version of the product are you using? On what operating system?
wp Version 2.8.2
carrington theme 2.1

Please provide any additional information below.

Original issue reported on code.google.com by Spartans...@googlemail.com on 1 Aug 2009 at 11:06

GoogleCodeExporter commented 9 years ago
the major problem that this minor problem has uncovered is that the / is 
removed each time.
all code become non xhtml.
e.g
<br /> becomes <br >,
<img src="http://thumbimage/example.jpg "/> becomes <img 
src="http://thumbimage/example.jpg ">

Original comment by Spartans...@googlemail.com on 1 Aug 2009 at 3:04

GoogleCodeExporter commented 9 years ago
This does not appear to be a Carrington issue, it's a general WordPress/PHP 
issue.

Original comment by alexking...@gmail.com on 2 Aug 2009 at 11:39

GoogleCodeExporter commented 9 years ago
I totally disagree with the comments here. This has nothing to do with the / 
being
removed.  The get_post_meta() is returned empty.

Do this:  Create a post and add a custom field of foo with a value of bar.  
Then add
this to any of the post templates:

<?php echo get_post_meta($post->ID, 'foo', true); ?>

The result should be 'bar'

But it is ''

Thanks

Original comment by husky.bi...@gmail.com on 17 Sep 2009 at 11:09

GoogleCodeExporter commented 9 years ago
I'm with husky.biped on this one as well - I just cannot convince content-
default.php to accept any known form of get_post_meta(), it always turns up 
empty.

However, inserting the same code (see below) into single.php of the default 
Wordpress 2.8.4 theme bring up the expected result. I would love to have this 
fixed 
in the otherwise excellent JAM theme ;)

$year = get_post_meta($post->ID, 'Year', true);
echo $year;

Original comment by lukescam...@gmail.com on 23 Sep 2009 at 1:47

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Hey Lukescammell,

Alex clued me in on another forum that this is an issue of variable scope:

http://carringtontheme.com/2009/06/remember-variable-scope/

It works perfectly now, and I have a feeling it will work for you too..

Original comment by husky.bi...@gmail.com on 23 Sep 2009 at 3:32

GoogleCodeExporter commented 9 years ago
Perfect Husky, thanks! This now works just as I always assumed it would! I must 
have 
missed this in the Carrington documentation somewhere...

global $post;
$year = get_post_meta($post->ID, 'Year', true);
echo $year;

Original comment by lukescam...@gmail.com on 23 Sep 2009 at 11:51