You don’t need a checkbox, you can code one if you want, but you can use the default Custom Fields.
Make sure they are enabled:
Then add some data on the posts you want to have a specific style on, you will need to add this to each post you want to have set to display: none;
:
Now inside the loop of your page you will add that value as a CSS class:
// loop starts
<?php $authoryes = get_post_meta( get_the_ID(), 'authordisplay', true ); ?>
<div class="page<?php echo $authoryes; ?>">
// rest of the loop
</div>
So now you just have to add one style to your CSS for .pageauthor
You should probably use a more unique name than “author” for the value, I did this fast.
Related Posts:
- Display a post count from a custom metabox selection
- How do I remove all the metaboxes for a custom post type?
- Get all posts from custom post type and insert in select input as metabox
- Detect meta value changes when post is updated (post_updated)
- Creating a custom post type upon registration
- Having trouble with custom post type / meta box
- How can I include meta box content when searching?
- update a post meta from a single table cell TablePress
- update custom post type meta from a shortcode
- Custom Meta Boxes – Nonce Issue – Move to trash issue
- Displaying Meta Box Image
- How to keep a check box in custom meta box for custom post type checked by default for add new post?
- How to add multiple featured image in meta box in post editor?
- Show metabox in custom-post-template depending on taxonomy term?
- Formatting custom meta box date from YYYY/MM/DD to a more readable alternative
- Displaying custom posts only if custom meta box’s date is not expired
- Displaying Metabox value (custom post type taxonomy)
- How can I display my custom metaboxes on a custom post template?
- Meta Box Only in CPT Edit Page, Not in Add New
- get_post_meta is returning image id
- Populate Custom Fields in a Custom Post Type?
- Custom meta box data array: foreach not working correctly?
- Undefined Variable – Custom Post Type Meta
- how to delete all users and posts based on ‘user_meta’?
- Populate dropdown from one custom post type inside another custom post type
- How to check if user meta field is empty in conditional else statement
- A better way to add a meta box to custom post types
- Restrict Access to Posts based on Custom User and Post Meta Data
- Metabox not show in categories custom post type cmb2
- Show Custom Post Type meta boxes only on Page Edit
- Can’t publish custom post type – “You are not allowed to edit this post.”
- Meta Data for Custom Post Type not saving
- create custom meta box with default value
- Displaying a div from an assigned meta_value when on a page
- How to Echo Metadata Value in Currency Format
- Issue on Working with Metabox – Checkbox to enable Sale Items
- Why do I have to press the “Update” button twice to save my meta box values?
- Values from meta-box not on $_POST
- Custom post type suddenly stoped working after WordPress 5 update
- How can I output WPAlchemy repeating fields meta values in my page template?
- Meta box data is saved but NOT displayed in the meta box text field. Why?
- Save Metabox Custom Field Value
- Meta box data not saving
- WP_Meta_Query object with conditionals
- Related posts meta_query CPT
- Sanitaizing Select Optin For Custom Post Type Metabox in WP
- How to retrive Custom Post Type Meta Fields in Custom WP_Query
- Cannot Save MetaBox Data in Custom Post Type
- Add a class to post_class if more than one post shares same meta_value_num
- Function to return values from metabox
- Add a meta field to the list of results for a custom post type
- Empty meta-box returns publishdate if no value is set?
- Custom Meta Box with variable number of fields
- Custom Post Type meta data getting deleted on bulk editing taxonomies
- Creating a custom post type upon registration for a specific user role
- Get meta values from parent post and save in child post
- Metaboxes in Loop
- Custom meta box data not saving
- Collect custom post in a calendar
- Delete custom post type metadata without deleting the post in admin area
- Problem with ‘save_post’ hook not running
- Edit post meta direct from post.php?
- Howto: use existing post_meta as options for a different metabox (checkboxes or list)
- Post AND page parameter for WP function
- How to display Author Profile based on Custom field value
- Use a Variable in update_post_meta as the $meta_key
- Query all posts where a meta key does not exist
- Can you make a custom metabox field be required to save a new post?
- Display content from custom meta boxes in revisions
- How to get custom metabox image field?
- Cleanest way to code “Custom Write Panels/Meta Boxes”?
- Send email button in custom post type backend
- Get posts between custom dates
- Create Connection Between two post types
- Storing a many to many post type relationship in post meta and keeping SQL ability for Joins
- Filter date from post meta when date is in string format
- Can I restrict category availability?
- Get $post->ID from a URL
- Using custom post type as taxonomy
- How to show custom field on specific custom post type posts only when filled
- Filter posts of custom post type by meta key in (List All Section)
- is_main_query() never called on WP 4.4
- saving dropdown menu data on custom post type
- Set Default Option Value as Blank for Meta Box
- Getting WordPress to store 0 values for custom post type meta
- Saving metabox keys and storing values as array
- Publish box in CPT remove ‘edit’ link
- Save data is post using php front end
- How to sort by multiple values in a nested WP_Query
- How do I create a customised table list of a custom post type (in the admin area)?
- Add other all taxonomies as meta boxes to custom post type
- How save custom meta type posts multicheck grouped by taxonomy (with CMB2) [closed]
- Meta-Box to add multiple items one at a time and on publish save all
- Values inside a custom field to determine which category posts to display
- How to rewrite CPT-Permalinks the correct way (incorporating meta-box-data)?
- Add Metabox to all custom post types
- Querying meta values within an array
- Creating entries with image attachements within posts and managing them in a list
- Issues on saving data from CPT select metabox
- Remove custom meta boxes from custom post type