my little journey through myself

I love this guy

October 27 2010 - In: coding cedmax


Jake Archibald | Reusable Code, for good or for awesome! | Fronteers 2010 from Fronteers on Vimeo.

So you want to style a post depending on its author?

you’re welcome

One of the most awful things I found out in a lot of wordpress themes is the hardcoded text.

I found out that with Simple Shortcodes it is possible to centralize in the admin part text content without editing themes.
download, install and activate it.

Go to the plugin admin page and you can add the content you need to use in your theme (in this case I’m also using qTranslate, that’s why I use <!–:it–> and <!–:en–>)


Then in your theme you can write the content of your shortcode simply calling a function named like the shortcode + ‘_shortcode’ for example


This could be surely useful in order to let someone manage site content without giving him permission on theme editor.

a step forward:

Plugin Name: Labelize Simple Shortcodes
Plugin URI: https://cedmax.net/archive
Description: use simple shortcodes plugin to delete hardcoded text in themes
Version: 1
Author: cedmax
Author URI: https://cedmax.net/archive

function get_label($shorcode, $echo=true, $before, $after) {
	$myfunc = $shorcode . '_shortcode';
		$output = $myfunc();
		if ($before) $output = $before . $output;
		if ($after) $output = $output . $after;		
		if ($echo) {
			return __($output);

a simple plugin, quick and dirty, to be used like this:


optional parameters:
$echo: use it as boolean (true or false) to have the label printed or returned as php string (default = true)
$before: if you want something before your label (markup for example)
$after: as before, but after the label

hope it could be useful