Load WordPress Admin to Blank Page
When you load yoursite.com/wp-admin you just get a blank page.
Open functions.php and remove the white space at the top and bottom.
When you load yoursite.com/wp-admin you just get a blank page.
Open functions.php and remove the white space at the top and bottom.
To find the most recent comments in WordPress use the following code:
$number=30; // number of recent comments desired
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT $number");
if ( $comments ) : foreach ( (array) $comments as $comment) :
echo sprintf(__('%1$s on %2$s'), get_comment_author_link(), '' . get_the_title($comment->comment_post_ID) . ' - ') . $comment->comment_date;
endforeach;
endif;
In WordPress sometimes you will want to show the most recent post from a specific category.
To do this use the following code:
global $post;
//change the category=1442 to the category number you want to pull the content from
//change numberposts=1 to the number of posts you want to return from the category
$myposts = get_posts('numberposts=1&category=1442&order=DESC');
foreach($myposts as $post) :
setup_postdata($post);
$catpost= " ". get_the_title() ."";
endforeach;
echo $catpost;
The wordpress function the_permalink() automatically echos the content to the screen.
Sometimes you want to store this value in a variable.
In this case use:
$string = get_permalink();
The wordpress function the_title() automatically echos the content to the screen.
Sometimes you want to store this value in a variable.
In this case use:
$string = get_the_title();
When you try to update/install a WordPress plugin you get the following error:
“Upgrade Plugin: Unable to locate WordPress Content directory (wp-content)”
Add the following code to the end of your wp-config.php file:
if(is_admin()) {
add_filter('filesystem_method', create_function('$a', 'return "direct";' ));
define( 'FS_CHMOD_DIR', 0751 );
}
When trying to access cached pages in WordPress you receive a 403 Permission Denied or 403 Forbidden error.
To fix you must add the following line to your wp-config.php (Add it above the WP_CACHE define.) Then clear your cache.
umask( 0022 );
If your PHP runs as a different user to Apache and permissions are strict Apache may not be able to read the PHP generated cache files.
The SyntaxHighlighter Plus plugin allows you to highlight different types of code within your wordpress posts:
CSS example
pre {
white-space: pre-wrap; /* css-3 */
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
}
PHP example
<?php
$block = module_invoke('block', 'block', 'view', 7);
print $block['content'];
?>
The module states it works upto WordPress 2.5 however it is working without any problems on 2.6.
It supports the following languages (the alias for use in the post is listed next to the name):
bash, shcpp, c, c++c#, c-sharp, csharpcssdelphi, pascaljavajs, jscript, javascriptphppy, pythonrb, ruby, rails, rorsqlvb, vb.netxml, html, xhtml, xsltPowered by WordPress | Aeros Theme | TheBuckmaker.com WordPress Themes