0


I have a specific Gallery post of products that I release at the start of every Monday on my website, which differs from my other Gallery posts.

These types of Gallery post don't require the Authors Bio or post Tags.


I have been manually going into the style.css file and changing it to read:

body.postid-9840 div.post-tags,
body.postid-9840 div#author-bio {display: none;}

However, this process has become time-consuming and is starting to take up a lot of room in my style.css file.


Is there a way I can display a Meta checkbox at the bottom of my Gallery post screen, that when clicked, is able to turn off/hide the Authors Bio and post Tags from being displayed on the front-end?


For example:

enter image description here

  • Yes, this can be done. Please show us what you have tried so far. – kaiser Feb 6 '14 at 2:02
  • Please don't use pastebins. File an edit and put the code in your question. – kaiser Feb 6 '14 at 2:53
1

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:

enter image description here

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;: enter image description here

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.