Dynamic Wordpress Theme

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kooza
Forum Newbie
Posts: 1
Joined: Sat Feb 28, 2009 2:17 am

Dynamic Wordpress Theme

Post by kooza »

I have a site with Wordpress installed in the root directory, I have also installed Article Dashboard in a directory called /articles.

I would like to use the same Wordpress theme for Article Dashboard rather than having two separate templates.

Is it possible to run an if statement which grabs the URL and displays certain elements depending on the directory.

For example

If the current page is within the articles directory /articles i.e. an article dashboard page then display <title>{SITETITLE}</title> else the page must be a Wordpress page therefore display <title><?php wp_title(); ?></title>

Any advice would be greatly appreciated,

Cheers,
Mike.
User avatar
php_east
Forum Contributor
Posts: 453
Joined: Sun Feb 22, 2009 1:31 pm
Location: Far Far East.

Re: Dynamic Wordpress Theme

Post by php_east »

don't know much about Wordpress, but URLs are available as ..hang on a second.

$_SERVER['REQUEST_URI'], a superglobal, so you could check on the URI from here and make decisions. i'm pretty sure you meant URI instead of URL.

like

Code: Select all

 
if (strpos($_SERVER['REQUEST_URI'],'/articles')) 
{
echo '<title>{SITETITLE}</title>'
}
else 
{
echo '<title>'.wp_title().'</title>';
}
 
if you have many pages, perhaps a switch case statement would be much better.
Post Reply