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
- Repeatable Fields Metabox with Textarea (or wp_editor)
- How to use TinyMCE Editor for one of my custom post meta field?
- Display correctly using metabox.io
- Create Connection Between two post types
- pre_get_posts for custom page builder meta box
- Disable closing on metaboxes
- Update database from Quick Edit according to Checkbox state of Custom Post Type
- Custom fields (wp_post_meta) vs Custom Table for large amount of data
- Storing a many to many post type relationship in post meta and keeping SQL ability for Joins
- Dynamic Custom Fields
- Query posts based on the meta key values of logged-in users?
- Cannot save CPT meta box
- How to make custom taxonomy into drop down select in a custom metabox
- Adding Page Templates to post but it ignored it
- Parent Page and Breadcrumb URL’s for Custom Post Types Not Working
- Create a Dropdown from Custom Post Type
- Translating custom post type metaboxes [closed]
- Adding a metabox on a CPT’s submenu page
- Custom filter function not working with Custom post type
- Fixed values for same post translations
- How to Add multiple instance of meta box to custom post type
- Using POST method in meta box, no results
- meta box on custom post type
- Checking if $_FILE isset for an array of file upload metaboxes
- Importing Data from a Non-WordPress database, into WP
- Ordering values entered in Custom Taxonomies
- Getting thumbnails of a custom posts featured images in a page-templates metabox
- Listing custom terms in custom post meta
- Permalinks: custom structure for taxonomy – tags?
- List Taxonomies: Don’t list taxonomy if it has no post – depending on custom post-meta?
- Custom Post Type & Meta Box – Displaying meta box information on front end?
- Remove Post Custom Meta Box
- How can I move (or create another) publish button?
- Wrap meta boxes & data handling for specific post types in classes?