Wordpress blank screen error solution
Stumbled upon an error: WordPress admin pages just went blank. No error reports, nothing. Discovered two possible reasons for it:
- corrupted WordPress files.
- White space after last entry in wp-config.php file.
Solutions:
If files are corrupted (incomplete uploads, for example): just use good ftp client, upload again. If curious: I use FireFTP for Firefox addon.
Take notice that files can be corrupted by malicious code too. In that case, change your passwords before uploading new versions of files.
If it doesn't help: check your wp-config.php file. Notepad++ is good for that. If you see white-space and / or endline characters at the end of your file, delete them.
Wordpress and SimplePie functionality
SimplePie functionality for your blog:
function fetch_feed_modified($url) {
require_once (ABSPATH . WPINC . '/class-feed.php');
$feed = new SimplePie();
$feed->set_feed_url($url);
$feed->set_cache_class('WP_Feed_Cache');
$feed->set_file_class('WP_SimplePie_File');
$feed->set_cache_duration(apply_filters('wp_feed_cache_transient_lifetime', 43200));
$feed->init();
$feed->handle_content_type();
if ( $feed->error() )
printf ('There was an error while connecting to Feed server, please, try again!');
foreach ($feed->get_items() as $item){
printf('<li><a href="%s">%s</a>',$item->get_permalink(), $item->get_title());
printf(' <small>%s</small></li>',$item->get_date());
}
}
function ms_smallpie_feed($uri) {
if(function_exists('fetch_feed_modified')) {
fetch_feed_modified($uri);
}
}
Co-authors author list bug
There is a bug inside Co Authors and Co Authors Plus plugin, coauthors_wp_list_authors function, where co authors without their own posts doesn't get links to their posts: http://wordpress.org/support/topic/275644
The bug is inside this sql statement:
$author_count = array(); $sql = "SELECT DISTINCT p1.post_author, (COUNT(ID)+(SELECT COUNT(*) FROM $wpdb->posts p2, $wpdb->postmeta pm WHERE p2.ID = pm.post_id AND pm.meta_key = '_coauthor' AND pm.meta_value = p1.post_author) ) AS count FROM $wpdb->posts p1 WHERE post_type = 'post' AND " . get_private_posts_cap_sql( 'post' ) . " GROUP BY post_author";
How to add Wordpress sidebar
There comes a time in every Wordpress developer life when he/she needs to add a sidebar. Don't be afraid, my friend! It's not as hard as it sounds like ![]()
To get that done you need functions.php and as many sidebar-<something unique>.php files as you many sidebars you want. All tucked inside your theme folder.
They all can be empty for now. We'll fill them out soon.
First, functions.php:
<?php
if ( function_exists('register_sidebar') )
register_sidebar('left');
register_sidebar('right');
?>