WP PHP Programming: Show WordPress Ads Based On Subdomains

Hello guys. I’m using the wp-subdomains found here: wordpress.org/extend/plugins/wordpress-subdomains/. which is a plugin for WordPress that allows you to setup your main categories, pages and authors as subdomains. I need to display ads based on post categories. I’ve found a method for doing so here: revolves.net/show-wordpress-ads-based-on-post-categories/.When I use the link structure: domain.com/category the ads show up, but when I turn the category to a subdomain (category.domain.com) this method does not work. I think is for the php coding. I don’t know php and want to know how to edit the displayads.php file discussed in that post to make it work for subdomains instead of categories. Any help? Thanks in advanced.

This is the code from the displayads.php file:

[php]

<?php $categories = get_the_category(); $fileName = strtolower($categories[0]->cat_name) . '.html'; $filePath = dirname(__FILE__) . '/' . $fileName; if (file_exists($filePath)) { ?>
<?php include $filePath; ?>
<?php } [/php] If you need more details please let me know and thanks in advance.

You are missing the close of the last PHP code…

The PHP code starts with " <?PHP " and ends with " ?> "… You need to close at the end of the file.
(After the last " } " !) You need to add the ?> … Hope that helps…

Sponsor our Newsletter | Privacy Policy | Terms of Service