I would first store your field value in a variable after your loop just before the posts HTML tags start:
<?php
$size = the_field( "size" );
?>
And then add this variable to the post class function:
<?php post_class($size); ?>
Related Posts:
- How to mark every 3rd post
- adding a custom css class to post
- Odd/even class on article tag
- How to add padding between posts
- Add Post Tags to Body Class
- Add a class to post title if a link ends with a certain extension
- How to make classes for posts?
- Add $values to post_class()
- Every second post different class in blog view
- How can I add a class to particular paragraphs in my post?
- Microformats in a single post – layout conflict
- How to mark every 3rd post
- Get the Current Page Number
- Removing any and all inline styles from the_content()
- Are post ID’s reliable?
- Pretty URL with add_query_var
- Download external images if post is publish
- Query posts from current year
- Convert IPTC keywords to blog post tags
- Facebook sharing link is not showing a thumbnail of the images within the post?
- How to wrap every image in a post with a div?
- Can I change a post to a page by changing it’s type?
- Publish posts only after the condition is met
- Order post by year DESC and month ASC
- Showing random content / pictures from earlier posts in a sticky post?
- Change existing label in the admin bar with something else
- Populating a page with content from post custom fields
- Limit function to specific post category
- How can I hook into creating a new post and execute wp_die(), before the post is inserted into the database?
- Function to show random posts from a category
- Change Order of Admin Posts Depending on Meta
- how to programmatically change post tags
- wp query with dynamic taxonomies and terms?
- How can I hide the sidebar from a specific post?
- How to run a function when post is edited or updated using publish post action?
- How do I use `posts_distinct` correctly?
- Getting a 404 error when clicking edit page
- How to find what index page a post is on?
- Display number of posts via adress bar?
- Admin Posts Table Column Fitlering is not working for Custom Post Type
- WordPress REST API not returning all posts
- Get Posts that are in the current month or later
- WP Query to Get Array of Slugs
- Displaying Latest Posts on a Page
- Email entire post contents
- How can i display gallery shortcode output under Post text
- Hiding Draft Post In Admin
- How to limit posts by category
- List category posts alphabetically on archive.php
- How can you change all past posts’ images to link to none instead of the image file?
- Apostrophe in a possessive appears as an open-single-smart-quote instead of a closed one
- Dynamic dependent Dropdown lists for categories, sub-categories and posts
- Only display sticky post or latest post in custom loop
- Security to delete post by Admin
- why there are so many posts whoes post_type is revision? will these records waste too much database space?
- Ignore latest two posts
- Grid post page on WordPress with Bootstrap, the_excerpt(); Problem
- Is there a way to create a meta box that can be added multiple times to a post dynamically?
- Filtering posts on Post Administration Page by Week Number instead of by Month
- Automatically set post_parent value
- Add two custom fields as a default to the “new post” page.
- Give posts a particular template based on the assigned category
- Show more than 200 images in one post
- List all native posts in template page?
- Scheduling posts via sql
- Display specific posts on home page
- The loop starting at a certain ID
- How to restore deleted post related with deleted users
- Posts and Pages w. private visibility don’t show up in existing content
- How do I display main query posts in random order using add_filter
- Aligning images in the wp editor not working. How do i get this to work in custom theme?
- How can I display the last updated post with the author, the created date, and the modified date on one line?
- How do i bring out post category name in my widget?
- Passing values via an Ajax querystring
- Filtering private Posts
- Show items from a DB in a Post
- How can I stop ‘in use’ message from intermittently blocking my wp_posts table?
- How to prevent WP from inserting empty posts
- How to Display Most View Post in the template file?
- display multiple posts and posts content on a single URL
- Set featured image on creating new post
- Get Categories & Posts With Type Article
- My post permalinks are always the same
- Show post excerpt
- Multipage Post URL correction
- Set multi posts random categories and tags
- Keep highlight on menu item with post pages
- How can I set and update the the_date according to a custom field of the post
- Adding editable content above posts
- Call image from post on index page?
- Post not showing up sometimes on website
- Extra field in wp_post instead of postmeta
- Same sidebar in all posts as in the category
- Voting System, database connections?
- Update Post with Modified Data
- Help post permalink
- Notify Author of the post if admin deletes his post and perform some function
- Wrap div-tag around posts in page
- Exclude posts by date – related post
- Post pages are redirecting to the 404 page in wordpress