assign css class with get_post_meta / custom field
-
Dear all,
for a small portfolio I’m trying to distribute the posts within my layout to 3 columns by reading the custom field ‘class’ output of my index.php. The vertical positions of column1, column2, and column3 are defined in my style.css
In the index.php I’m ‘distributing’ within the loop with
<?php unset($additional_class); $additional_class = get_post_meta($post->ID, 'class', true); if ($additional_class) : ?> <div class="<?php echo $additional_class;?>"> <?php endif; ?>
As a matter of fact the value for column1, 2, 3 is assigned for each single post.
How can I define the vertical position of my columns, read the ‘column-value’ of the post and distribute it to column1, 2, or 3?
(Left column looks fine, the one in the middle and on the right doesn’t?!)After fiddling arround for days (unfortunately without too much knowledge of php and css:( ) and spending hours on forums, I’m maybe not able to see THE SIMPLE solution anymore…?
Really hope someone can help me out a bit.
Regards
- The topic ‘assign css class with get_post_meta / custom field’ is closed to new replies.