Archive for the ‘WordPress KB’ Category
Posted by Shane on May 19, 2010 2:18 am
Hi,
Problem Summary:
Many wordpress users getting this error message when they try to login into the wordpress admin area:
Fatal error: Call to undefined function wp_dashboard_setup() in /home/username/public_html/wp-admin/index.php on line xxx
Possible Solution:
It seems that it is due to the PHP version and settings changed on the hosting server. In order to resolve this problem, you have to modify the wp-admin/index.php file.
Find this code in wp-admin/index.php:
require_once(ABSPATH . ‘wp-admin/includes/dashboard.php’);
Replace with:
require_once(‘./includes/dashboard.php’);
This should resolve the problem.
Thanks,
Shane G.
Popularity: 1%
Posted by Shane on May 14, 2010 5:55 pm
Hi,
You can set Tag Cloud limit on your wordpress blog which can help to control page rank flow. In order to limit the Tag Cloud on wordpress blog, you have to edit the core file of the wordpress. First, fine this file yourdomain.com/wp-includes/category-template.php and download it to your local machine using ftp.
Find This Code:
unction wp_tag_cloud( $args = ” ) {
$defaults = array(
’smallest’ => 8, ‘largest’ => 12, ‘unit’ => ‘pt’, ‘number’ => 45,
Now, change the 45 to equal the desired number of tag cloud. Now, save and upload the file again on the server.
NOTE: You have to fix this at every update of wordpress version.
Thanks,
Shane G.
Popularity: 1%
Posted by Shane on April 25, 2010 8:30 pm
Hi,
When user trying to manipulation on WordPress Database using $wpdb class, the following error or similar error may appear:
Error Message:
WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near…]
Possible Solutions:
One of the reasons for the errors is caused by post_ID or ID variable that represents the ID of the wordpress post. Depending on which version of PHP, MySQL or wordpress you are using.
The $post_id or $id or $post->ID can be placed within single quote (‘) as the workaround or resolution to avoid or solve the error.
Thanks,
Shane G.
Popularity: 1%
Posted by Shane on 8:20 pm
Hi,
In the wordpress loop section, each posts displayed on the page with defined format along with such criteria decided by administrator. The Loop template tag the_ID can be used to easily display the post’s ID inside the post.
Alternatively, inside the the_content filter, declare $id global and use $id to retrieve the post ID. the_ID template tag can be used in this format:
Many time user requires to get Post ID outside the loop template tag. In such cases, the_ID function can not work. In that case, $post->ID will be used to return the post ID. $post is a global object that holds various information about the posts displayed on the page. If the $post is used inside a function, the $post has to be declared as a global variable. For example::
// Works inside of the Loop
function function_name() {
global $post;
$thePostID = $post->ID;
}
or:
// Works in single post outside of the Loop
function function_name() {
global $wp_query;
$thePostID = $wp_query->post->ID;
}
$post->ID can be called directly outside of the Loop too in a single post template, such as ID ?> will print display the post’s ID number. In the multiple posts view page such as index page or archive page, it’s possible to retrieve the get the latest or earliest post ID of all the posts displayed on the page by using an ORDER BY clause to order the posts by date, and then set the number of record to LIMIT 1. Just for example, and there are various way to use the query:
//Get the latest post ID number
$post->ID ORDER BY post_date ASC LIMIT 1
//Get the earliest post ID number
$post->ID ORDER BY post_date DESC LIMIT 1
Thanks,
Shane G.
Popularity: 1%
Posted by Shane on March 8, 2010 1:03 pm
Hi,
Problem Error:
Warning: array_key_exists() [function.array-key-exists]: The first argument should be either a string or an integer in /your-sitepath/wp-includes/category-template.php on line 176
Possible Solution:
- This problems stems from line 176 as stated above. The simple fix is to make sure the first argument is a string, to do this we will rap it in double quotes.
Change line 176 from:
if(array_key_exists($category, $categories))
To
if(array_key_exists(‘$category’, $categories))
Just add single quotes around the first $category variable which will fixed the issue.
Thanks,
Shane G.
Popularity: 1%
Posted by Shane on March 5, 2010 12:54 pm
Hi,
Problem Summary:
I have upgraded wordpress version to the latest along with plugins. I have encountered this error message on my blog as well as while trying to login into the admin area of the blog:
Fatal error: Call to undefined function: str_split() in /home/…/htdocs/wp-content/plugins/pods/init.php on line 27
Possible Solution:
- str_split is a PHP 5 function. It seems that your site/blog is running on PHP4 version. Hence, upgrade your domain/blog PHP version to PHP5 with the help of your hosting service provider. Once you upgrade it, your problem should be resolved positively.
Thanks,
Shane G.
Popularity: 1%
Posted by Shane on December 11, 2009 2:32 am
Hi,
In order change the background image of your blog, you need to upload the image in image folder of your theme. Image must be the same pixel as the old image. Othewise it may wrap the page.
Image folder path: blog-directory/wp-content/themes/theme-folder/images
Image name should be; bg.jpg
Thanks,
Shane G.
Popularity: 1%
Posted by Shane on 1:54 am
Hi,
Many wordpress users likes the theme but wants to change the sidebar angle from left to right and visa versa. I have described here how to switch the sidebar in wordpress theme. I have provided details here to move sidebar from left to right.
In order to change the sidebar angle, you need to edit the style.css file of the theme. Open style.css file of your theme to edit it.
Search This Code:
.narrowcolumn
{
float: left;
padding: 0 0 20px 45px;
margin: 0px 0 0;
width: 450px;
}
Replace above code with this code;
.narrowcolumn
{
float: right;
padding: 0 45px 20px 0px;
margin: 0px 0 0;
width: 450px;
}
Now, search this code;
#sidebar
{
padding: 20px 0 10px 0;
margin-left: 545px;
width: 190px;
}
Replace with this code:
#sidebar
{
padding: 20px 0 10px 0;
margin-left: 20px;
width: 190px;
}
You can set the margin accoring to your requirement. Now, save this file and upload to your theme folder.
In order to change the sidebar from right left. Need to do the reverse process.
That’s it!
Thanks,
Shane G.
Popularity: 1%
Posted by Shane on December 4, 2009 6:35 pm
Hi,
These are the documentation – guidelines for wordpress theme development:
1. Indicate precisely what your Theme and template files will achieve.
2. Adhere to the naming conventions of the standard theme hierarchy.
3. Indicate deficiencies in your Themes, if any.
4. Clearly reference any special modifications in comments within the template and style sheet files. Add comments to modifications, template sections, and CSS styles, especially those which cross template files.
5. If you have any special requirements, which may include custom Rewrite Rules, or the use of some additional, special templates, images or files, please explicitly state the steps of action a user should take to get your Theme working.
6. Try and test your Theme across browsers to catch at least a few of the problems the users of the Theme may find later.
7. Provide contact information (web page or email), if possible, for support information and questions.
A README file included with your Theme helps many users over any potential stumbling blocks.
Thanks,
Shane G.
Popularity: 1%
Posted by Shane on October 23, 2009 8:01 am
Hi,
WordPress 2.8+ has new feature of the_modified_author() which allows you to display the latest who has modified the post. In order to display the modified post author you can use this hack and add this code in functions.php file:
if (!function_exists(‘get_the_modified_author’)) {
function get_the_modified_author() {
global $post;
if ( $last_id = get_post_meta($post->ID, ‘_edit_last’, true) ) {
$last_user = get_userdata($last_id);
return apply_filters(‘the_modified_author’, $last_user->display_name);
}
}
}
if (!function_exists(‘the_modified_author’)) {
function the_modified_author() {
echo get_the_modified_author();
}
}
Once you have updated the functions.php file, you can use this code to display the last modified post author details:
<?php the_modified_author(); ?>
That’s it!
Thanks,
Shane G.
Popularity: 1%