Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I want to create a live demo site like http://www.elegantthemes.com/gallery/ that show themes so when I click on the theme screenshot it takes me to the live theme preview.

I tried two plugins themebrowser and wordpress-theme-showcase they are showing the themes in a list and I can click the theme to view, but when I'm trying to go to any page inside the preview theme it takes me to the original theme that already installed, so also I want to be able to browse the demo theme pages and posts like if it is activated.

Thanks

Edit: From the source code of wordpress-theme-showcase plugin the Theme Preview URI: php?preview_theme=WordPress%20Default and that's ok for he home page of the new theme, but if I want to go to some page it redirects me to the home page of the installed theme. So I tried to add &p=1 (post url) to the end of the Theme Preview URI above and it works. The question now is how I can append this url to all the links in the preview page

share|improve this question
    
Please move your solution to an answer. That is fine and even encouraged so it's in line with site's mechanics and question does not haunt site as unanswered. –  Rarst Nov 18 '12 at 13:37
    
@Rarst, I tried to post an answer but I have low reputation, so will add answer after the time. –  Ahmad Ajmi Nov 18 '12 at 13:40
    
This may also help you or someone. Introducing Item Switcher. –  Shoebox Nov 18 '12 at 20:52

1 Answer 1

up vote 0 down vote accepted

Solution

I used the wordpress-theme-showcaseplugin to show a list of themes in the home page, and to can easily browse the theme that is currently preview I changed the way wordpress handle the permalinks. In the wp-includes/link-template.php file in get_permalink function added this code

if(isset($_GET['preview_theme'])){
    $permalink = home_url('?preview_theme='.$_GET['preview_theme'] .'&p=' . $post->ID);
    }else{
    $permalink = home_url('?p=' . $post->ID);
}

and in _get_page_link function added this code

if(isset($_GET['preview_theme'])){
    $link = home_url("?preview_theme=".$_GET['preview_theme'] ."&page_id=$id");
    }else{
    $link = home_url("?page_id=$id");
}

Hope this will be useful for any one will get this problem.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.