简体   繁体   中英

Wordpress Theme Demo

Hey how do I showcase my themes like WooThemes has done. I don't want to use multiple databases and Wordpress installations? Can you suggest me any reliable solution which lets me use the same database for all themes.

Thanks

If all the themes use the same CSS setup (what I mean by that is all the id's and classes that you use for styling are the same in all the themes) then you could simple have a drop down menu with this

JavaScript function:

function themeChange(selection)
{
    window.location = "viewtemplate.php?theme=" + selection;
}

And with this HTML:

<select onchange="themeChange(this.options[this.selectedIndex].value)">
    <option value="0" selected="selected">Select Theme</option>
    <option value="1">Theme 1</option>
    <option value="2">Theme 2</option>
</select>

Once the page loads you can use PHP to retrieve the theme selection value and then inject the correct CSS style sheet for that theme.

PHP:

<?php
$theme = $_GET['theme'];

if ($theme == 1)
{
   ?>
   <link rel="stylesheet" type="text/css" href="theme1.css">
   <?php
}
else if ($theme == 2)
{
   ?>
   <link rel="stylesheet" type="text/css" href="theme2.css">
   <?php
}
?>

Hope that helps :)

Thanks

尝试主题切换器插件。

Nice tips thanks for sharing You were prescient with adding video to WP back in 06-07. I've come late to the party but things are still evolving and many people are still waiting to jump in. Plus there are so many more hosting platforms to use now.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM