Google XML Sitemaps with Multisite support

Google XML Sitemaps with Multisite support is just modified Google XML Sitemaps plugin, originally written by Arne Brachhold.

Some time ago I was employed to work on Gnosis.hr site, which needs to drive two sites on one WordPress installation – one for Croatian version and another for the English one. Everything seemed fine until I realized that Google XML Sitemaps isn’t working with Multi site installation.

My modification changes this – you can have numerous sites on one installation and each of them can have own sitemap.

Installation:

  • Install “Google XML Sitemaps with Multisite support” through the WordPress admin (or download)
  • Create “sitemaps” directory in directory where you’ve installed WordPress
  • Make “sitemaps” writeable”

That’s it. 99% percent of work is done by Arne so, thank you Arne. I hope that our projects will merge into the one in the near future.

UPDATE: Plugin is no more supported since there are many other plugins doing the same thing.

Adding default custom fields on new posts in WordPress

Custom fields are essential part of every WordPress site. You know how to add it – Enter new – [type some name] – [type some content] – Add custom field. It’s not complicated process, but it is not as simple as it could be, especially if all of your posts need to have same custom fields, for example, price, size or some very general values. If it is your case, use this snippet and make your life easier.

<pre>add_action('wp_insert_post', 'mk_set_default_custom_fields');

function mk_set_default_custom_fields($post_id)
{
	if ( $_GET['post_type'] != 'page' ) {

		add_post_meta($post_id, 'price', '', true);
		add_post_meta($post_id, 'link', '', true);

	}

	return true;
}</pre>

Simple, right?

You can put numerous custom fields or put just one. It’s up to you.
Oh, I forgot. This adds an empty custom field (with no value). For adding custom field with some value add 

<pre>add_post_meta($post_id, 'custom field name', 'custom field value', true);</pre>

Your editors don’t like the dashboard? Redirect them!

Wordpress DashboardSince a small team (1dva) I freelanced for had migrated to WordPress, I’ve heard numerous times that old CMS was better. I know that our customers do not know why it is better, but I have to find out why they more like the Nano. The answer is more simple than I have expected – our customers don’t like the Dashboard, it is more friendly to go directly to Edit Posts page. Read how to redirect wordpress user from Dashboard. Continue reading

Creating stylesheet for Headline Replacement

Headline Replacement can be really useful, especially because we are able to choose what titles exactly we want to replace. Version 0.1.1 is out, but the plugin is still difficult to handle with. You have to display image as the img tag what is not the proper way (according the W3 standards) if the image is just replacement for the title . Let’s see how to create automatic stylesheet and avoid img tags. Continue reading

Headline Replacement 0.1

Headline Replacement is a simple WP plugin that allows you uploading replacement image for post/page title. It is based on Unique Image for Article plugin originally written by Pavol Klacansky, but there are some modifications and improvements.

The fact that you must upload image and then go to Media tab to find the image in order to use it as a headline was annoying. Now it is past, upload and use! No unnecessary steps.

Continue reading