I'm a PHP newbie and I have a question about implementing ads on Wordpress. If I want to show ads only on the homepage, category and page, how do I do this? I have tried: function header_ad() { if (is_home()) || (is_category()) || (is_page()) { ?> Code (markup): But, it doesn't work. Any advice would be appreciated.
I'm just a noob like you. try this mate, <?php function header_ad() { /** Your function to show ad **/ } ?> <?php if (is_home()) || (is_category()) || (is_page()) { ?> <?php header_ad(); ?> <?php } ?> Code (markup):
if u use wp as a cms and use a 'page' as the homepage, you need to check if you're on homepage by the using the actual pageID e.g. is_page($pageID) or something similar as far as i remember.
You don't need a set of PHP tags on every line. <?php function header_ad() { /** Your function to show ad **/ } ?> <?php if (is_home()) || (is_category()) || (is_page()) { header_ad(); } ?> PHP:
easiest way is to go to your dashboard click widgets add text widget copy the code from adsense or any other advertiser and paste in the text area and press save!!!
There are many plugins for almost any type of work in wordpress. Just google them and you can find multiple options.
Best thing about Wordpress is that you can customize your blog the way you want it, and you can find some themes just for that