We help IT Professionals succeed at work.

Sidebar categories/archives no longer showing up after server migration..??

Andrew Angell
on
I've got WP installed here on my live server: http://www.usbswiper.com/blog. Everything is great there and has been for a while now.

I'm moving this site to a new server and I've copied all site files and db data over to the new server accordingly. That can be viewed here: http://sandbox.usbswiper.com/blog.

Everything is great on the new server except that in the sidebar the Categories and the Archives are no longer showing up.

I can login to the admin panel just fine, and all of the categories and everything still looks just fine in there.

If I activate the Twenty Ten theme they come back, so it must be something about my theme, but I can't figure it out because the same exact theme files are working perfectly on 1 server but not on the other.

This is the only thing not working with the entire site migration inside or outside of WP, so it's the only thing keeping from flipping the switch on DNS to point to the new server.

Any information on why this is happening or how I can troubleshoot it would be greatly appreciated. Thanks!
Comment
Watch Question

Jason C. LevineDon't talk to me.

Commented:
If the DNS is not pointed, how are you checking the installation on the new server?  IP address?
Andrew AngellCo-Owner / Developer

Author

Commented:
DNS is pointed to the new server for sandbox.usbswiper.com.  I have tested www.usbswiper.com on the new server, too, though, by updating my local hosts file to point to the correct IP address.

Again, though, as it stands now, www points to my current live server and sandbox points to my new server where the problem is happening.  Everything was copied over directly, though.  
Jason C. LevineDon't talk to me.

Commented:
What is the Wordpress URL set to on the new server then?
Andrew AngellCo-Owner / Developer

Author

Commented:
sandbox.usbswiper.com.

Everything about it is working great except for the sidebar items.  The blog itself loads fine.  I can get into the admin panel.  I can see all of the pages, posts, categories, etc.  But the sidebar items just don't show up for some reason.

Again, it's only happening with the theme I made that matches my site, but the same exact theme files are working great on the www site.  On sandbox, though, they're not.  

Since the files and the DB are exactly the same (except for www vs sandbox) I'm stuck on how to troubleshoot or fix this.
Andrew AngellCo-Owner / Developer

Author

Commented:
I also just now noticed that while "the loop" seems to be working and displaying the Posts on my blog home page, it's not showing the author correctly like it should.  

I'm still just lost, though, because all of the files are exactly the same as what's on the server that's working.
Jason C. LevineDon't talk to me.

Commented:
Install the Search and Replace plugin and see if there are any database entries that have www. instead of sandbox.

http://wordpress.org/extend/plugins/search-and-replace/
Andrew AngellCo-Owner / Developer

Author

Commented:
There are no database entries with www.  The procedure I always follow (and have literally done 100+ times without ever having this issue) is...

1) Download all site files from original server and upload everything to new server directly.
2) Export SQL file from original database.  Then open that up and do a find/replace for www.domain.com to change them all to sandbox.domain.com.
3) Execute SQL file on new server database.
4) Load sandbox.domain.com in the browser and everything works accordingly.

This procedure has never failed me, and even now, if it was seeing www everything else wouldn't load.  

On top of that, I moved everything direclty without any change at all so I could test www.domain.com on the new server as well.  When doing this I follow this procedure...

1) Download all site files from original server and upload to  new server directly.
2) Using Navicat, I transfer the database from the original server to the new server directly.  No exporting or importing, no find/replace, etc.  All data is transferred directly from one DB to the other.
3) Update local hosts file to point www.domain.com to the new server IP so I can test prior to actually updating DNS.
4) Load www.domain.com in browser for testing accordingly.

Here again, though, I'm having the exact same problem.  So there's no chance at all that the site URL could be the issue in this case as everything was copied directly from one to the other and the site URL did not change in this case.  Still, though, I'm having the exact same problem on both www.domain.com and sandbox.domain.com on this new server.

What's interesting, too, is that previously, I had www.domain.com running on 1 server, while sandbox.domain.com was running on an entirely different server.  I had followed all of the same procedures at that time and both of those servers worked as expected.

Now I've got both www and sandbox running on the same server, and they're both having this problem.  Again, though, other themes are working fine.  It's only my theme that's having this issue (which is further evidence that the site URL is not the problem).
Jason C. LevineDon't talk to me.

Commented:
Okay, I'm just trying to rule things out.  

Can you post the relevant PHP for categories and archives from the sidebar?  

Andrew AngellCo-Owner / Developer

Author

Commented:
I've attached my sidebar.php here, as well as functions.php.  Let me know if you need to see anything else.


<aside>
    <?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('Sidebar Widgets')) : else : ?>
        <!-- All this stuff in here only shows up if you DON'T have any widgets active in this zone -->
    	<?php // get_search_form(); ?>
    	<?php wp_list_pages('title_li=<h2>Pages</h2>' ); ?>
        <h2>Categories</h2>
        <ul>
    	   <?php wp_list_categories('show_count=1&title_li='); ?>
        </ul>
        <h2>Archives</h2>
    	<ul>
    		<?php wp_get_archives('type=monthly'); ?>
    	</ul>
    	<?php // wp_list_bookmarks(); ?>
        <h2>Subscribe</h2>
    	<ul>
    		<li><a href="<?php bloginfo('rss2_url'); ?>">Entries (RSS)</a></li>
    		<li><a href="<?php bloginfo('comments_rss2_url'); ?>">Comments (RSS)</a></li>
    	</ul>
    	<h2>Login</h2>
    	<ul>
    		<?php wp_register(); ?>
    		<li><?php wp_loginout(); ?></li>
    		<?php wp_meta(); ?>
    	</ul>
	<?php endif; ?>
    <h2>Login</h2>
    	<ul>
    		<?php wp_register(); ?>
    		<li><?php wp_loginout(); ?></li>
    		<?php wp_meta(); ?>
    	</ul>
</aside>

Open in new window

<?php	
// Add RSS links to <head> section
automatic_feed_links();

// Load jQuery
if ( !is_admin() ) {
   wp_deregister_script('jquery');
   wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"), false);
   wp_enqueue_script('jquery');
}

// Clean up the <head>
function removeHeadLinks() {
	remove_action('wp_head', 'rsd_link');
	remove_action('wp_head', 'wlwmanifest_link');
}
add_action('init', 'removeHeadLinks');
remove_action('wp_head', 'wp_generator');

// Declare sidebar widget zone
if (function_exists('register_sidebar')) {
	register_sidebar(array(
		'name' => 'Sidebar Widgets',
		'id'   => 'sidebar-widgets',
		'description'   => 'These are widgets for the sidebar.',
		'before_widget' => '<div id="%1$s" class="widget %2$s">',
		'after_widget'  => '</div>',
		'before_title'  => '<h2>',
		'after_title'   => '</h2>'
	));
}

// 06.14.2011 - Added shortcodes pulled from an ElegantThemes theme.
require_once($_SERVER['DOCUMENT_ROOT'].'/blog/wp-content/themes/usbswiper/assets/shortcodes/shortcodes.php');
?>

Open in new window

Andrew AngellCo-Owner / Developer

Author

Commented:
I enabled the WP debugger, and now I'm seeing this error..

[Table 'usbswipe_usbswiper_dev.aewp_users' doesn't exist]

That database does exist on m y server, however, wp-config.php does not reference it at all.  My WP tables are installed in usbswipe_wordpress_dev, and that is what wp-config.php references.

Since my theme is the only one with this problem, it must be my theme somehow making it look at the wrong database...but I have no clue how that could be.  Do you have any ideas?
Andrew AngellCo-Owner / Developer

Author

Commented:
Yeah, somehow my theme's db connection is conflicting with the WP db connections.

I've got my own config.php that uses $db_host, $db_name, $db_username, and $db_password.  This is what drives my primary site.  The WP blog is secondary to all of this and has its own database.

wp-config.php points to the WP database, but somehow, my theme (which does connect and display data from my own database) is overriding that with my primary DB credentials, so then the WP tables aren't found.

I can't figure out why that would be happening, though.  I don't have that problem on my other servers with the same theme files.
Jason C. LevineDon't talk to me.

Commented:
It wouldn't be wp_config, it would be in the WP tables somewhere or hardcoded into the theme.  What is it for?  Plugin?
Co-Owner / Developer
Commented:
Ok, I got this working, but I'm still confused about why it was happening.

I had 2 separate databases:  one for my own stuff and one for WP.  Within my theme I'm connecting to my own database to display data from it accordingly, but this was conflicting with the WP scripts somehow and wound up causing them to look at the wrong database.

I moved all of my WP tables into the same database as my other stuff and updated wp-config.php accordingly.  Now everything is working as it should.

Still, though, why would my own db connection conflict with WP's?  I guess I just never noticed it before because on my live server the primary DB and the WP db had different host names.  On my previous test server I was already using the same DB for everything, so this always just worked there and I never even realized my theme was overriding the WP table.

On my new server I was leaving the DB's separate, but they're both on localhost, and somehow it wound up conflicting.

So I still have no idea why that is as they're separate PHP vars, separate databases, etc.  Combining my WP tables in my primary DB and using those credentials makes it all load correctly, though.
Jason C. LevineDon't talk to me.

Commented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.