I have a problem with defining a wordpress variable for a class. This is my code: I created a custom field for posts with the anme class. Here I'd like to retrieve the class. If the custom field is empty, the class should be set to "col1" by default
$masonry_col_class = get_post_meta($post->ID, 'class', true);
if (!empty($masonry_col_class)){ $masonry_col_class='col1'; };
And here's the output for the css:
<ul class="<?php echo $masonry_col_class ?>">
The if (!empty...) doesn't seem to work though.
I would be thankful for any help. -n-