[IF STATEMENT] How to say “Don’t Show On Pages”
-
I have very mild PHP experience (basically I just started about a week and a half ago) and I’m trying to add some functions to one of my sites that I’m testing on a local server.
Anyways here is the issue. I added a hook that allows after every post to have an auto statement at the end, like a foot note. Basically this:
function insertFootNote($content) { if( if(!is_feed() && !is_home()) { $content.= "<div class='subscribe'>"; $content.= "<h4>Enjoyed this article?</h4>"; $content.= "<p>Subscribe to our <a href='feedurlhere'>RSS feed</a> and never miss a post!</p>"; $content.= "</div>"; } return $content; } add_filter ('the_content', 'insertFootNote');
The problem is that it shows up on my PAGES too, and I don’t want that. Only on blog posts. As you can see I started to type out an IF Statement on line 2. However, I quickly noticed I don’t know what verbage use.
I basically want it to say “IF it is a page, do not use footnote. IF it is a post, use footnote”. I just don’t know what words to put after that.
Any help is greatly appreciated. Also if anyone has a good source of hooks that’d be great as well.
Thank you!
Okay I figured it out. I simply added at line 3 (2 without the unused if) !is_page and it removed it from pages.
- The topic ‘[IF STATEMENT] How to say “Don’t Show On Pages”’ is closed to new replies.