Forums

try, as I may, can't get theme switcher to work (37 posts)

  1. bookyeti
    Member
    Posted 6 years ago #

    I'm new to WordPress and php. Maybe that's not such a good combo; even though I'm quite familiar with the workings of HTML. I'm working with WP 1.5 and I'm using a modified version of the coffee_cup theme. I've been trying to install Ryan Boren's theme switcher ...I've followed the directions and still can't seem to get it to work.

    A few things I've checked, before you kindly suggest them: I've activated the plug-in in my admin panel; that's fine. I've added the tag to my sidebar.php as instructed. However the switch theme section isn't showing up at all on my page - I'm not even getting an error message. So yes, I'm thoroughly puzzled and running out of options of what to do/try. Thought I'd ask here from some help, if you feel willing to help out a confused soul...

    The address of my page is: http://www.bookyeti.com/wp
    I've tried different things but nothing seems to prove successful. A few things I've checked, before you kindly suggest them: I've activated the plug-in in my admin panel; that's fine. I've added the tag to my sidebar.php as instructed. However the switch theme section isn't showing up at all on my page. I thoroughly puzzled.

    The address is: http://www.bookyeti.com/wp/

  2. vkaryl
    Member
    Posted 6 years ago #

    Okay. In the source for your site, I'm not finding the theme-switcher at all. So something's wonky there....

    [Gentle nudge: by "backticks", is meant that you place the code in between the keyboard backtick which is the oddball little character on the lower part of the tilde key usually found on PC keyboards above the tab key - in other words, one of these (`) before and after the code....]

  3. vkaryl
    Member
    Posted 6 years ago #

    Now, after looking at one of my own sidebars, here's what works on my sites:

    <li>
    <?php if (function_exists('wp_theme_switcher')) { ?>
    <h2><?php _e('Themes'); ?></h2>
    <ul>
    <li><?php wp_theme_switcher('dropdown'); ?></li>
    </ul>
    <?php } ?>
    </li>

    If you don't want a dropdown box (a cleaner alternative in my view, but that's just me), then that section needs to be
    <?php wp_theme_switcher(); ?> instead.

  4. bookyeti
    Member
    Posted 6 years ago #

    hah! I just figured out the backtick thing. Oh, boy. I need some coffee. Thank you for being kind. :)

    I will try your suggestion now...
    I really appreciate the quick response.

  5. vkaryl
    Member
    Posted 6 years ago #

    Let us know how it goes!

  6. bookyeti
    Member
    Posted 6 years ago #

    Hmm...it's strange. I've added that script you suggested into my sidebar.php, and it's not seeming to have ANY effect on my index.php.

    I wonder what's up with that? Any ideas? :(

  7. bookyeti
    Member
    Posted 6 years ago #

    Here's my sidebar.php:

    <div id="sidebar">
    <ul>
    <li><h2><?php _e('Categories'); ?></h2>
    <ul>
    <?php list_cats() ?>
    </ul>
    </li>
    <li><h2><?php _e('Monthly Archives:'); ?></h2>
    <ul>
    <?php wp_get_archives('type=monthly'); ?>
    </ul>
    </li>
    <?php /* If this is the frontpage */ if (is_home()) { ?>
    <li><h2><?php _e('Links'); ?></h2>
    <ul>
    <?php get_links('-1', '<li>', '</li>', ''); ?>
    </ul>
    </li>
    <li>
    <?php if (function_exists('wp_theme_switcher')) { ?>
    <h2><?php _e('Themes'); ?></h2>
    <ul>
    <li><?php wp_theme_switcher('dropdown'); ?></li>
    </ul>
    <?php } ?>
    </li>
    <?php } ?>
    <li><h2><?php _e('Meta'); ?></h2>
    <ul>
    <li><?php wp_loginout(); ?></li>
    <li><a href="http://validator.w3.org/check/referer" title="<?php _e('This page validates as XHTML 1.0 Transitional'); ?>"><?php _e('Valid <abbr title="eXtensible HyperText Markup Language">XHTML</abbr>'); ?></a></li>
    <li><a href="http://wordpress.org/" title="<?php _e('Powered by WordPress, state-of-the-art semantic personal publishing platform.'); ?>"><abbr title="WordPress">WordPress </abbr></a></li>
    <?php wp_meta(); ?>
    </ul>
    </li>
    <?php } ?>
    </ul>
    </div>

    and of course you can see my index.php in source...

  8. vkaryl
    Member
    Posted 6 years ago #

    I'm still not seeing anything relating to theme-switcher in your source. Here's the sidebar stuff from a source display of your page:

    <!--------- SIDEBAR ---------->
    <div id="container">
    <div id="sidebar">
    <ul>
    <li>
    </li>
    <!--- CATEGORIES --->
    <li><h2>Categories</h2>
    <ul>
    <li><a href="http://www.bookyeti.com/wp/index.php?cat=1" title="View all posts filed under daily diddly squat">daily diddly squat</a>
    </li>
    <li><a href="http://www.bookyeti.com/wp/index.php?cat=2" title="View all posts filed under bibliophile rhapsody">bibliophile rhapsody</a>
    </li>
    <li><a href="http://www.bookyeti.com/wp/index.php?cat=3" title="View all posts filed under operation picket fence">operation picket fence</a>
    </li>
    <li><a href="http://www.bookyeti.com/wp/index.php?cat=4" title="View all posts filed under ol' grind">ol’ grind</a>
    </li>
    <li><a href="http://www.bookyeti.com/wp/index.php?cat=5" title="View all posts filed under the Truth will set you free">the Truth will set you free</a>
    </li>
    <li><a href="http://www.bookyeti.com/wp/index.php?cat=6" title="View all posts filed under dilettante artsy-fartsy">dilettante artsy-fartsy</a>
    </li>
    <li><a href="http://www.bookyeti.com/wp/index.php?cat=7" title="View all posts filed under memes for youyous">memes for youyous</a>
    </li>
    </ul>
    </li>
    <!--- ARCHIVES--->
    <li><h2>Monthly Archives:</h2>
    <ul>
    <li><a href='http://www.bookyeti.com/wp/?m=200510' title='October 2005'>October 2005</a></li>
    <li><a href='http://www.bookyeti.com/wp/?m=200509' title='September 2005'>September 2005</a></li>
    <li><a href='http://www.bookyeti.com/wp/?m=200508' title='August 2005'>August 2005</a></li>
    <li><a href='http://www.bookyeti.com/wp/?m=200507' title='July 2005'>July 2005</a></li>
    <li><a href='http://www.bookyeti.com/wp/?m=200506' title='June 2005'>June 2005</a></li>
    <li><a href='http://www.bookyeti.com/wp/?m=200505' title='May 2005'>May 2005</a></li>
    <li><a href='http://www.bookyeti.com/wp/?m=200504' title='April 2005'>April 2005</a></li>
    <li><a href='http://www.bookyeti.com/wp/?m=200503' title='March 2005'>March 2005</a></li>
    <li><a href='http://www.bookyeti.com/wp/?m=200502' title='February 2005'>February 2005</a></li>
    <li><a href='http://www.bookyeti.com/wp/?m=200501' title='January 2005'>January 2005</a></li>
    <li><a href='http://www.bookyeti.com/wp/?m=200412' title='December 2004'>December 2004</a></li>
    <li><a href='http://www.bookyeti.com/wp/?m=200411' title='November 2004'>November 2004</a></li>
    <li><a href='http://www.bookyeti.com/wp/?m=200410' title='October 2004'>October 2004</a></li>
    <li><a href='http://www.bookyeti.com/wp/?m=200409' title='September 2004'>September 2004</a></li>
    <li><a href='http://www.bookyeti.com/wp/?m=200408' title='August 2004'>August 2004</a></li>
    </ul>
    </li>
    <!-- Links -->
    <li><h2>Links</h2>
    <ul>
    <li><a href='http://www.bookyeti.com/strangeme.html'>about moi</a></li>
    <li><a href='http://www.amazon.com/gp/registry/registry.html/103-2801956-6207859?id=GF1QQ4IR2LCM'>amazon wishlist</a></li>
    <li><a href='http://www.bookyeti.com/archives/rat.html" target="_blank"'>archives</a></li>
    <li><a href='http://www.bookyeti.com/blog/castcharacters.html'>cast</a></li>
    <li><a href='http://javascript:showShoutbox()'>chatbox</a></li>
    <li><a href='http://www.amazon.com/exec/obidos/tg/detail/-/1582431892/qid=1128026275/sr=2-1/ref=pd_bbs_b_2_1/002-5780206-8691238?v=glance&s=books'>current read</a></li>
    <li><a href='http://www.bookyeti.com/blog/bloglinks.html" onclick="window.open(this.href, 'popupwindow', 'width=250,height=590,scrollbars=none'); return false;" target="_blank"'>friends</a></li>
    <li><a href='http://www.bookyeti.com/bookshelf.html'>home</a></li>
    <li><a href='http://www.bookyeti.com/blog/radio.blog/index.php" onclick="window.open(this.href, 'popupwindow', 'width=225,height=350,scrollbars=none'); return false;" target="_blank"'>music</a></li>
    </ul>
    </li>
    <!--- META --->
    <li><h2>Meta</h2>
    <ul>
    <li><a href="http://www.bookyeti.com/wp/wp-login.php?action=logout">Logout</a></li>
    <li><a href="http://validator.w3.org/check/referer" title="This page validates as XHTML 1.0 Transitional">Valid <abbr title="eXtensible HyperText Markup Language">XHTML</abbr></a></li>
    <li><a href="http://wordpress.org/" title="Powered by WordPress, state-of-the-art semantic personal publishing platform."><abbr title="WordPress">WordPress </abbr></a></li>
    </ul>
    </li>
    </ul>
    </div>

    I cleared cache and hard-refreshed before I checked source. Somehow your changed page isn't showing after upload....

  9. bookyeti
    Member
    Posted 6 years ago #

    Yes, that seems to be it. I wonder why the sidebar and index aren't 'speaking' to each other. :-/

    Is there anything in my index source that would explain that?

  10. vkaryl
    Member
    Posted 6 years ago #

    Doubtful. As long as the call to include the sidebar is in the proper place, nothing else would whack it - the include call just pulls in everything that's in the sidebar file.

    Try resaving your sidebar file, then delete the current instance from the server, and upload it fresh.

  11. Beel
    Member
    Posted 6 years ago #

    You must not be putting it into the correct sidebar.php (maybe you are in the wrong theme directory?) as there is not even an empty <li></li> which would be there whether or not the plugin is activated. This thread is becoming hard to follow with all the irrelevant code posting ;-)

    Don't forget you will have to put the theme switcher code in every theme sidebar.

  12. vkaryl
    Member
    Posted 6 years ago #

    *rolls eyes* I'M not having a hard time, Beel.... sheesh.

    bookyeti, that's another thing.... every theme you use is going to need the same call for the theme-switcher, or you'll get "stuck" on a theme that's missing it....

  13. bookyeti
    Member
    Posted 6 years ago #

    vkaryl - I'll try doing that again, as you suggest. I've done it various times over though, and it doesn't seem to make a difference.

    Beel - I am definitely put it in the correct sidebar.php. It's located in the wp/theme/coffee-cup/ directory where it should be. I guess that's why I'm so confused. I've checked, and double checked. :-/

  14. vkaryl
    Member
    Posted 6 years ago #

    Okay, one other thing to check is that when you're uploading it it's going into the correct theme folder. You don't want to know how many times I've screwed the pooch on that very thing!

  15. bookyeti
    Member
    Posted 6 years ago #

    I know. :) I've done it once before.
    But I assure you, this time, that part is definitely kosher.

  16. vkaryl
    Member
    Posted 6 years ago #

    Jeez. I HATE gremlins, and that's what this sounds like....

    Um. Now I'm getting a parse error in your sidebar.php when I try reloading your page.... says there's an "unexpected" } (curly brace) on line 38....

  17. bookyeti
    Member
    Posted 6 years ago #

    Yes, I just tried uploaded a new index and sidebar php...
    That didn't seem to work either. heh.
    let me check things...

  18. bookyeti
    Member
    Posted 6 years ago #

    line 38 is this second-to-the-last line...

    <?php } ?>

  19. bookyeti
    Member
    Posted 6 years ago #

    Just a brain fart here but....
    Does text encoding have anything to do with theme switching?

  20. vkaryl
    Member
    Posted 6 years ago #

    Well, try pulling the curly brace out of it.

  21. vkaryl
    Member
    Posted 6 years ago #

    Not generally.... why?

  22. bookyeti
    Member
    Posted 6 years ago #

    Okay, took out that curly brace.
    There's no error now and the page shows up as normal...but there's also NO sign of a theme switcher. Argh! :)

  23. vkaryl
    Member
    Posted 6 years ago #

    Look, tell you what: zip your whole install and email it to me at vkaryl *at* bytehaven *dot* com. I'm hunting off and on the next few days, but in between I'll load it up on a test-bed and see if I can work out what it's problem is. That would maybe be better than trying to tweak through here....

  24. bookyeti
    Member
    Posted 6 years ago #

    Just wondering re: the text encoding as I'm not using the normal UTF-8, rather I'm utilizing ISO-8859-1.

  25. bookyeti
    Member
    Posted 6 years ago #

    Gosh, you'd do that for me? Thank you so much! I'll send that off to you tonight. That is very thoughtful of you. :)

  26. vkaryl
    Member
    Posted 6 years ago #

    Not a problem, lots of times it's easier for just one person to look at stuff in one spot and figure out the situation. I should be back to you on it by Monday sometime, as I said I'll be in and out over the weekend....

    [Nah - the encoding wouldn't matter....]

  27. bookyeti
    Member
    Posted 6 years ago #

    That's no problem...please, at your leisure.
    Thanks once again. :)

  28. Beel
    Member
    Posted 6 years ago #

    Yes, I must have looked at the source at a time you had deleted the addition as the empty <li></li> is now there. Then the next test is WP actually has access to the function.

    What error do you get if you remove the (function_exists...) portion of the code? If you do not get a function does not exist error then how many themes do you have published?

    Edit: What I mean is removing the function check:
    <?php if (function_exists('wp_theme_switcher')) { ?>
    and
    <?php } ?>

  29. bookyeti
    Member
    Posted 6 years ago #

    If I remove those 2 bits of code I get this error...

    Fatal error: Call to undefined function: wp_theme_switcher() in /usr/home/sites/www.bookyeti.com/web/wp/wp-content/themes/coffee_cup/sidebar.php on line 25

  30. Beel
    Member
    Posted 6 years ago #

    Then for some reason when you activate the plugin it must not be actually activated. I suspect it will work just fine for vkaryl when he gets around to testing it.

    Make doubly sure it is activated. Do your other plugins activate and work just fine?

Topic Closed

This topic has been closed to new replies.

About this Topic