WordPress debug mode and xml-rpc problems

This post is about using xml-rpc to post in WordPress. If you experience problems of this type:

32700:parse error. not well formed

or

32300:transport error - HTTP status code was not 200

It can be many things, but we have been crazy checking all the configuration until we realised that the problem was coming from the fact that the WordPress installation had the WP_DEBUG flag set to TRUE

define('WP_DEBUG', 'true');

And you should change it to FALSE

Advertisements

Deactivate WordPress plugins that don’t let you load wp-admin page, from database

It has always been a problem, that WordPress will stop loading the admin panel if there are problems generated by the plugins.

If you have access to the database, you can fix the broken WordPress admin panel by running this query:

SELECT * FROM wp_options WHERE option_name = 'active_plugins';

And removing what you obtain in the field:

a:31:{i:0;s:13:"AddMySite.php";i:1;s:19:"akismet/akismet.php";i:2;s:23:"all_in_one_seo_pack.php";i:3;s:16:"authenticate.php";i:4;s:28:"breadcrumb-navigation-xt.php";i:5;s:18:"codeautoescape.php";i:6;s:37:"contact-coldform/contact_coldform.php";i:7;s:32:"custom-query-string-reloaded.php";i:8;s:30:"customizable-post-listings.php";i:9;s:33:"dd-sitemap-gen/dd-sitemap-gen.php";i:10;s:20:"download-counter.php";i:11;s:13:"feedcount.php";i:12;s:13:"full_feed.php";i:13;s:15:"get-weather.php";i:14;s:36:"google-sitemap-generator/sitemap.php";i:15;s:13:"gravatars.php";i:16;s:19:"kill-admin-nags.php";i:17;s:18:"landingsites13.php";i:18;s:30:"nofollow-free/nofollowfree.php";i:19;s:17:"ol_feedburner.php";i:20;s:16:"plugins-used.php";i:21;s:22:"popularity-contest.php";i:22;s:39:"search-everything/search_everything.php";i:23;s:27:"simple-tags/simple-tags.php";i:24;s:26:"simple_recent_comments.php";i:25;s:18:"simple_twitter.php";i:26;s:25:"subscribe-to-comments.php";i:27;s:24:"the-excerpt-reloaded.php";i:28;s:18:"theme-switcher.php";i:29;s:9:"top10.php";i:30;s:16:"wp-db-backup.php";}

Thanks to Perishable Press for their detailed explanation:

http://perishablepress.com/quickly-disable-or-enable-all-wordpress-plugins-via-the-database/

Custom thumbnail sizes in WordPress: tips and hints to master them

I am working on a new WordPress theme and have identified several issues with the thumbnails.

Some initial clarifications:

When you use the function to get the thumbnail from a post, what you will be getting is the featured image.

Initially WordPress comes with pre-defined sizes by default:

the_post_thumbnail('thumbnail');       // Thumbnail (default 150px x 150px max)
the_post_thumbnail('medium');          // Medium resolution (default 300px x 300px max)
the_post_thumbnail('large');           // Large resolution (default 640px x 640px max)
the_post_thumbnail('full');            // Original image resolution (unmodified)

 source: http://codex.wordpress.org/Post_Thumbnails

You can define custom sizes and names for new types of thumbnails. 

But you will have to regenerate the thumbnails in order to have the new images created, in case you would like to use the “crop” parameter, that is, that the image created will not be a resize, but rather taking the content from the center of the existing full-size image. 

This is explained pretty well here: http://codex.wordpress.org/Function_Reference/add_image_size

What is not explained in the Codex documentation is that the crop option will not work unless you regenerate the thumbnails. How do you regenerate the thumbnails?

There are several alternatives that I am aware of:

1. Delete permanently and upload the image again

2. Use the regenerate thumbnail plugin: http://wordpress.org/plugins/regenerate-thumbnails/

3. With PHP code, doing something like this:

include( ABSPATH . ‘wp-admin/includes/image.php’ );
wp_generate_attachment_metadata( $thumbnail_id, $absolute_path_to_image );

following this: 

http://codex.wordpress.org/Function_Reference/wp_generate_attachment_metadata

A discussion on this can also be found here http://wordpress.stackexchange.com/questions/35833/the-post-thumbnail-hard-cropping-not-working-no-matter-what/128032#128032

How to make a language switcher menu in PHP

this snippet will work if you have a structure like this

(English pages)

/contact

/about

/blog

(Spanish pages)

/es/contact

/es/about

es/blog

This is the code you can put in a menu as a list item. It would work nicely in a wordpress website.

<li>
<? if (substr($_SERVER[“REQUEST_URI”],1,2) == “es”) { ?>
<li><a href=”/<? echo substr($_SERVER[“REQUEST_URI”],4); ?>”>In English</a></li>
<? } else { ?>
<li><a href=”/es<? echo $_SERVER[“REQUEST_URI”]; ?>”>En español</a></li>
<? } ?>
</li>

Yoast SEO problem with the News: Notice: Undefined index: wpseo_sitemaps

I was currently using All-in-one-SEO in my blog, but looking for a solution to send also sitemap to Google News I cam across with Yoast SEO plugin, which is great, but I found this bug when trying to configure 

News SEO for WordPress & Google – Yoast

The problem was:

Notice: Undefined index: wpseo_sitemaps

It breaks your blog installation

This is caused when you have unticked the option to generate the XML sitemap. I had to uninstall the files, so the plugins were no longer recognized and had to reconfigure it.