I have been searching for the answer on this, and still haven't found something that works. Could someone kindly let me know how to exclude the following code from all the picture attachment pages of Wordpress? This code is currently in my single.php file so that I can manage it from a central location. I don't know a whole lot about code so any information you can provide is greatly appreciated.

Thanks in advance!

`<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style ">
<p style="padding-left: 15px;"><a class="addthis_counter addthis_pill_style"></a>
&#x00A0;<a class="addthis_button_facebook_like" fb:like:layout="button_count">&#x00A0;</a>
&#x200B;<a class="addthis_button_tweet">&#x200B;</a>
<a class="addthis_button_pinterest_pinit"></a>
<class="addthis_toolbox addthis_default_style"> 
<a class="addthis_button_linkedin_counter" li:counter="none"></a>  
&#x00A0;<a class="addthis_button_google_plusone" g:plusone:count="false">&#x00A0;</a>
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=xa-518895bb724be09b"></script>
<!-- AddThis Button END -->`

Not tried this myself, but try adding

<?php if ( ! is_attachment() ) { ?>
all your current stuff
<?php } ?>
  • Perfect! Thank-you so, so much as you have ended so much frustration for me! – user2376452 Jul 4 '13 at 21:01
  • If you are satisfied with the answer, please mark it as correct (click the tick) so other people know. – vancoder Jul 4 '13 at 21:04
  • Yes, thank-you, there was a mandatory waiting period, but I have it now! :-) – user2376452 Jul 4 '13 at 21:14

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.