Apr
10
2013
0

WordPress Feed Invalid Char

When you open your WordPress sites RSS feed in the browser you get the following error:

“WordPress Feed Invalid Char”

The error will also show you the the line number of the error.

View the source of the feed and go to the line of the error. Find the corresponding post in your WordPress admin.

Copy the title and body into notepad (note this will remove all formatting).

You will be able to see the non UTF8 characters in notepad and be able to delete them. You can then copy and paste the problem text back into WordPress.

The offending characters won’t show in the WordPress admin hence having to copy into notepad.

Written by Pete in: wordpress |
Mar
18
2013
0

How to Post to Twitter & Facebook from WordPress

There are a lot of different plugins for posting to Twitter or Facebook from within WordPress however the easiest I’ve found is through a plugin called Social.

Social allows you to add Twitter and Facebook accounts from settings then when you post new content it prompts you to automatically post to the social networks.

http://wordpress.org/extend/plugins/social/

Written by Pete in: wordpress |
Jul
10
2012
0

Add HTML in WordPress Category Description

Add the following two lines to your themes functions.php file

remove_filter( ‘pre_term_description’, ‘wp_filter_kses’ );
remove_filter( ‘term_description’, ‘wp_kses_data’ );

Written by Pete in: wordpress |
Mar
02
2012
0

WordPress Pages & Posts not showing

If when you load the wordpress admin none of your pages & posts are showing, do the following:

  1. Edit wp-config.php and add
    define('WP_ALLOW_REPAIR', true);
    
  2. Open the database repair URL
    HOSTNAME/wp-admin/maint/repair.php

This should force an upgrade of the database. Remember to remove the line from wp-config after running the upgrade.

Written by Pete in: wordpress |
Aug
04
2011
0

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.

Written by Pete in: wordpress |
Jul
07
2011
0

Find Most Recent Comments

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;

Written by Pete in: wordpress |
Jul
07
2011
0

Find the most recent posts from a specific category

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;

Written by Pete in: wordpress |
Jul
07
2011
0

Store the_permalink() as a variable

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();

Written by Pete in: wordpress |
Jul
07
2011
1

Store the_title() in a variable

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();

Written by Pete in: wordpress |
Apr
23
2011
0

Unable to locate WordPress Content directory (wp-content)

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 );
}

Written by Pete in: wordpress |

Powered by WordPress | Aeros Theme | TheBuckmaker.com WordPress Themes