I have created portfolio page type in wordpress-theme with 3 column layout for portfolio item’s. I want to create meta-box with drop down to select column number for portfolio list item (may be Images), so I can change column number from 1 column to 4 column layout. I have css class for list item which is responsible for 3 column layout. How can I change css class for list Item with custom field value to change number of column layout.
I have created portfolio page type in wordpress-theme with 3 column layout for portfolio
Share
Ok. Create your custom field. Let’s say “number_of_columns”. Type your values in this custom field on each page.
Then in your page template, just use
get_post_metato output the value in a CSS rule name, like this :There you go. If number_of_columns was 2, you will get a div with the 2_column_layout class, etc. Right answer?