{"id":353,"date":"2005-09-15T22:18:20","date_gmt":"2005-09-15T20:18:20","guid":{"rendered":"http:\/\/frenchfragfactory.net\/ozh\/?p=353"},"modified":"2007-05-09T23:50:00","modified_gmt":"2007-05-09T21:50:00","slug":"how-to-tweak-wordpress-themes-without-messing-your-blog-around","status":"publish","type":"post","link":"https:\/\/planetozh.com\/blog\/2005\/09\/how-to-tweak-wordpress-themes-without-messing-your-blog-around\/","title":{"rendered":"How To Tweak WordPress Themes Without Messing Blog Around"},"content":{"rendered":"<p>Ever wanted to test or tweak an alternate Theme for WordPress, but don&#39;t want things to look messy for your visitors ? You have two solutions.<\/p>\n<p><b>Another Test install<\/b><br \/>\nThat&#39;s an easy one, just set up another WordPress blog and play with it, tweak it, break it, no once cares. The only thing you may want to check before playing is that it sends no ping (Options \/ Writing \/ Update Services) and no trackback (Options \/ Discussion) when you post random junk, because your test install will soon be discovered by others &#8230; and by spammers :)<\/p>\n<p><b>Use the Theme Switcher<\/b><br \/>\nThis solution doesn&#39;t even require you to set up another blog. It consists in installing a Theme Switcher, and making it available for you only.<\/p>\n<ol>\n<li>Get the plugin : <a href=\"http:\/\/dev.wp-plugins.org\/file\/theme-switcher\/trunk\/theme-switcher.php\">theme switcher<\/a><\/li>\n<li>Activate it<\/li>\n<li>Add the following code somewhere in your <em>sidebar.php<\/em> :\n<div id=\"ig-sh-1\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">php<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"php\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #000000;font-weight: bold\">&lt;?php<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #b1b100\">if<\/span> <span style=\"color: #009900\">&#040;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; <span style=\"color: #009900\">&#040;<\/span><span style=\"color: #990000\">preg_match<\/span><span style=\"color: #009900\">&#040;<\/span><span style=\"color: #0000ff\">&quot;\/wordpressuser&amp;#91;^=&amp;#93;*=admin\/i&quot;<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #000088\">$_SERVER<\/span><span style=\"color: #339933\">&amp;<\/span><span style=\"color: #666666;font-style: italic\">#91;&quot;HTTP_COOKIE&quot;&amp;#93;))<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #009900\">&#041;<\/span> <span style=\"color: #009900\">&#123;<\/span> <span style=\"color: #000000;font-weight: bold\">?&gt;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; <span style=\"color: #339933\">&lt;<\/span>div id<span style=\"color: #339933\">=<\/span><span style=\"color: #0000ff\">&quot;themeswitcher&quot;<\/span><span style=\"color: #339933\">&gt;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; <span style=\"color: #339933\">&lt;<\/span>h3<span style=\"color: #339933\">&gt;<\/span>Theme<span style=\"color: #339933\">&lt;\/<\/span>h3<span style=\"color: #339933\">&gt;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; <span style=\"color: #000000;font-weight: bold\">&lt;?php<\/span> wp_theme_switcher<span style=\"color: #009900\">&#040;<\/span><span style=\"color: #009900\">&#041;<\/span><span style=\"color: #339933\">;<\/span> <span style=\"color: #000000;font-weight: bold\">?&gt;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; <span style=\"color: #339933\">&lt;\/<\/span>div<span style=\"color: #339933\">&gt;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #000000;font-weight: bold\">&lt;?php<\/span> <span style=\"color: #009900\">&#125;<\/span> <span style=\"color: #000000;font-weight: bold\">?&gt;<\/span><\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<\/li>\n<\/ol>\n<p>From now on, people logged in with &quot;admin&quot; will be able to see the theme switcher and select another theme. Others will stick to the theme selected by default.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Useful tips.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[76,245,108],"class_list":["post-353","post","type-post","status-publish","format-standard","hentry","tag-tips","tag-wordpress","tag-wordpress-theme"],"_links":{"self":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/posts\/353","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/comments?post=353"}],"version-history":[{"count":0,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/posts\/353\/revisions"}],"wp:attachment":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/media?parent=353"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/categories?post=353"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/tags?post=353"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}