- This topic has 5 replies, 2 voices, and was last updated 8 years, 6 months ago by bdbrown.
-
AuthorPosts
-
September 21, 2015 at 2:52 pm #138621Stacy Fout
I have a disclaimer on my site that I have placed in my GP Hooks to show up after entry title of the post. I like it there, but I don’t want it on every post. It looks like a way to fix that would be to execute PHP script. I put all deal-type posts in one category. Is there a way to write PHP script that would show the disclaimer on only posts in that particular category?
While we’re on the subject, it would also be great to get it excluded from the front page teaser. Right now, I only include the title, featured image and a tag for read more on each post so the only text readers see is the title and a disclaimer right under my byline. Kind of a turn off. My site is mommado.com if you want to see what I am talking about.
Thanks in advance for the help.
Stacy
September 21, 2015 at 5:03 pm #138639bdbrownHi Stacy. In your hook you could do this; make sure to check the Execute PHP box. Change the category ID to your category:
<?php if (in_category( '3' )) { echo 'your disclaimer here'; } ?>
Adding this to your child theme css will hide the disclaimer on the home page posts:
.home .inside-article sub { display: none; }
But first you need to fix a couple of things in your child theme css.
.page-header-image-single { text-align: center; } .page-header-image-single { display: none; <-------------------- missing a closing bracket here a { color: #324cc0; } a:hover { color: #333333; }
And not sure why all this is in your css file; should be removed:
Other Options – a:link a:visited a:active <script type="text/javascript" src="//s3.amazonaws.com/downloads.mailchimp.com/js/signup-forms/popup/embed.js" data-dojo-config="usePlainJson: true, isDebug: false"></script><script type="text/javascript">require(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"mc.us11.list-manage.com","uuid":"cad522133eccd68f256285159","lid":"efc38a70ec"}) })</script>
September 24, 2015 at 10:03 pm #139546Stacy FoutThanks so much for the reply. I edited my CSS to get it excluded from the front page; it worked great. I also took out the extra tidbits. I think I threw that Mailchimp stuff in there for my newsletter RSS feed… think being the operative word.
I have not, as of yet, been able to get the category exclusion to work. I am not sure if it is because I added the extra subtext code or if I am mistyping your code. Sorry, rookie here.
This is what I have under the GP for After Entry Title:
<?php
if (in_category( ‘MommaDoes: Deals’ )) {
echo ‘<sub>This MommaDoes: Deals post was hand-picked by Stacy. The links in the post below may be affiliate links. Read the full disclosure.</sub>’;
}
?>September 25, 2015 at 9:51 am #139697bdbrownGlad the home page fix is working. The disclaimer is displayed on the following posts, all of which have a class of “category-deals”:
http://mommado.com/today-only-40-off-cartwheel-savings-on-costumes/
http://mommado.com/crazy-8-2-88-clearance-deals/
http://mommado.com/texas-sized-savings-for-the-texas-state-fair/Is that not what you were trying to accomplish?
September 25, 2015 at 10:12 am #139709Stacy FoutYes, that is exactly what I was trying to accomplish. I swear when I looked at a few posts yesterday in other categories, it was still showing the disclaimer on those as well. Today, though, it is only showing on disclaimers. Not sure why it wasn’t that way yesterday, but either way it’s perfect! Thanks so much for the assist.
September 25, 2015 at 12:28 pm #139744bdbrownMaybe there was a cache that was updated overnight? In any case, glad it’s working and you’re welcome 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.