Custom Fields with if/else
-
hello everyone
i need some help with my little php problem.
i have two custom-fields in my wp called “vorschautext” and “artikelbild”. artikelbild is an image, and vorschautext is a little text.my probem is now, that i want an if/else.
if this custom fields are empty should come the wp-normal content, like that:
–
if(vorschautext = empty and vorschaubild = empty){
the_content(”);
}else{
echo vorschautext and vorschaubild
}
–i tried to solve that with that code, but that doesnt works:
–
<?php
$vorschautext = get_post_custom_values(‘vorschautext’);
$artikelbild = get_post_meta($post->ID, (‘artikelbild’), true);if((empty($vorschautext) && empty($artikelbild)){
the_content(‘Lese den Rest dieser Story »’);}else{
echo ‘<img src=”‘ . $artikelbild . ‘” />’ . $vorschautext;
}
?>
–does anyone need a soltion??
thank you very much!
rho
- The topic ‘Custom Fields with if/else’ is closed to new replies.