- This topic is empty.
Viewing 7 posts - 1 through 7 (of 7 total)
Viewing 7 posts - 1 through 7 (of 7 total)
- The forum ‘Back End’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Hello guys,
I´m looking for a solution to have a default image when this custom field (wordpress) it is not in use.
'/>
Any idea?
Many thanks.
Rai.
$img = get_post_meta($post->ID, 'imagen', true);
if ($img) {
echo '
';
} else {
echo '
';
}
?>
Thanks Doc,
But it show me this error:
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/content/57/6689957/html/azahararomaterapia/wp-content/themes/azahar/pagina-producto.php on line 19
Oops! Terrible copy/pasting!
$img = get_post_meta($post->ID, 'imagen', true);
if ($img) {
echo '
';
} else {
echo '
';
}
?>
Give that a go!
Excellent Doc!,
Can you recommend something to read to learn the code at that level?.
Thanks.
That was actually just a modified version of a snippet from this very site! https://css-tricks.com/snippets/wordpress/using-custom-fields/
As far as suggestions on where to learn, I don’t really have any. It’s just repetition, practice practice practice.
Try to not take on too much at once or else none of it will stick. Focus on a few features at a time and really try to master them before you move on to something else.
Thanks Doc!.