Page 1 of 1

Dynamic Wordpress Theme

Posted: Sat Feb 28, 2009 2:30 am
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.

Re: Dynamic Wordpress Theme

Posted: Sat Feb 28, 2009 12:12 pm
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.