Articles in the ‘Wordpress Plugins’ Category

Thursday, January 12th, 2012

This WordPress plugin is a complete flexible Projekt Task Management System. It’s a very easy to use, but yet a powerful plugin. It helps you take control of all tasks when developing a WordPress Theme in a team or with a client.

Apart from common task management system features, Project Tasks have unique functions to link each task to a specific object in WordPress. And when you’re editing a page, it knows what objects and elements that page is made of.

Let’s say you have a page that uses the a certain page template, contains three different shortcodes and two different post types. When you create a project task on that page, these templates, shortcodes and posttypes comes up as suggestions to link your task to.

Project Tasks are accessable from the WordPress Adminbar when browsing your WordPress site where you can see how many and which tasks are linked to that particular page.

Project Tasks are also available from the the WordPress Admin that gives you an overview of all tasks and where you can manage them properly.

Download

You can download the latest version from the WordPress repository.

Installation

  1. Upload the full directory into your wp-content/plugins directory
  2. Activate the plugin at the plugin administration page

How to use

Once you’ve activated the plugin in your WordPress server you can access the Project Tasks from:

  • The Project Tasks Menu in WordPress Admin
  • Project Tasks in WordPress Adminbar

The Project Tasks Menu in WordPress Admin

The Project Tasks menu in WordPress admin

On this Project Tasks overview you have access to all tasks in the system. You can add a new Task and filter what Tasks you want to see, for instance only tasks of a certain type, that are assigned to you as a logged in user, or that are currently open.

Project Tasks in WordPress Adminbar

As you can see on the far right in the picture above, there is an entry for Project Tasks in the Adminbar. The number next to the header is telling how many tasks currently are asigned to this page, or to objects on this page. When clicking on the Project Tasks button, a dropdown list with these project tasks are shown.

Editing a Project Task

When you want to edit a project task you just click on the entry in either WordPress Adminbar Project Task Dropdown list, or in the Project Tasks Menu in WordPress Admin.

On the second tab you connect the project task to a “Target”. A target is an object in WordPress that the project task aims to do something about. Like, editing the content on a page, coding a shortcode, editing a page template, and so on. When creating or editing a task from Project Task Overview, you can access all possible targets on this tab. When getting here from the Adminbar on a specific page, you only see the targets that are available on that specific page. If the page uses Template A, Template A is shown as a target and not Template B. If someone has uses a shortcode on that page, that shortcode is listed as a target too.

On the third tab you can write notes. Whatever notes you want to.

On the fourth tab there is a complete log of what have been done to this task since it was created. Every change is logged here.

The program is very powerful yet flexible. There are a number of adjustments that can be done with wordpress hooks.

WordPress hooks

This is just one example: The following code adds a custom project task type called “Design task”, puts in a custom task target of that type called “Stylesheet Correction” and makes that custom project task target appear on every page that uses the page template called “page-template-2.php”

// Add a custom project task type called Design task
function custom_projekt_tasks_task_type ( $task_types ) {
	array_push ( $task_types, array ( 
		'id' 		=> 'my_design_tasks', 
		'name'		=> 'Design task', 
		'plural'	=> 'Design tasks'
	));
	return $task_types;
}
add_filter ( 'projekt_tasks_task_types', 'custom_projekt_tasks_task_type' );


// Create a task target called Stylesheet Correction as a "global" projekt task target 
// and put it under Design Tasks
function custom_project_task_target ( $task_targets ) {
	array_push ( $task_targets, array ( 
		'target_type' 		=> 'my_design_tasks', 
		'target_id' 		=> 'my_target_id', 
		'target_category' 	=> 'Design task', 
		'name' 			=> 'Stylesheet Correction', 
		'item_name' 		=> 'On all pages',
		'shortening' 		=> 'C', 
		'order' 		=> 1, 
		'description' 		=> 'Connect this task to the page stylesheet design.' 
	));
	return $task_targets;
}
add_filter ( 'projekt_tasks_targets', 'custom_project_task_target' );



// Make the custom project task target appear on every page that uses the page template 
// called "page-template-2.php"
function custom_project_task_target_on_page ( $active_targets, $post ) {
	$page_template_name = get_post_meta( $post->ID, '_wp_page_template' ,true );
	if ( $page_template_name == 'page-template-2.php' ) {
		array_push ( $active_targets, array ( 
			'target_type' 	=> 'my_design_tasks', 
			'target_id' 	=> 'my_target_id',  
			'item_name' 	=> 'The Stylesheet for the Page Template 2',
			'description' 	=> 'Connect this task to the page stylesheet design 
						on Page Template 2.' 
		));
	} 
	return $active_targets;
}
add_filter ( 'projekt_tasks_active_targets_on_post', 'custom_project_task_target_on_page', 10, 2 );  

Support

Unfortunately I can’t give any support on this plugin except what can be found at the WordPress forums for this plugin.

License

This plugin is released under the GPL, you can use it free of charge on your personal or commercial site. But every small donation for the time I’ve spent writing and supporting this plugin is very appreciated.

Monday, January 9th, 2012

This WordPress plugin makes it possible to show content from one page on another – it mirrors content. It’s a very easy to use, but yet a powerful plugin.

It takes content from pages, posts and custom post types and shows it on other pages, posts or custom post types. It also works between sites in a Multi-site configuration. For instance, if you have a web site with one site for each language, you only reuse the same information on all sites.

Download

You can download the latest version from the WordPress repository.

Installation

  1. Upload the full directory into your wp-content/plugins directory
  2. Activate the plugin at the plugin administration page

How to use

Once you’ve activated the plugin in your WordPress server you invoke Content Mirror in the editor.

Within the editor, make sure Kitchen Sink is available and then press Insert Content Mirror button.

You’ll now see the Content Mirror Selector Window.

Select what content you want to mirror and press Insert. To get back to the Content Mirror Selector, just press the top left button in the blue square representing the Content Mirror. The delete button next to that, yes, it deletes the Content Mirror.

Advanced use

There’s even more ways of using this plugin:

  • Use Content Mirror Variables
  • Write Shortcodes, Plugins and Themes compatible with Content Mirror

Use Content Mirror Variables

Let’s say you have page “Swedish Tools” which content you want to show on page “All Tools”. So, you edit page “All Tools”, inserts a Content Mirror-object and points it to page “Swedish Tools”. Everything is fine.

Then you think, mmm, I want some parts of that page “Swedish Tools” to be different if user watch it thru page “All Tools”. So you insert a conditional tag at page “Swedish Tools” that looks like this:

[contentmirrorif name=lookdifferent value=true]
THIS LOOKS DIFFERENT
[/contentmirrorif]

And then you go back and edit page “All Tools”, look for the content mirror shortcode in HTML-mode and adds a variable to the shortcode manually, like this:

[contentmirror site=1 posttype=page item=34 lookdifferent=true]

Page “All Tools” will now display the text “THIS LOOKS DIFFERENT”, and that will not be the case when looking at page “Swedish Tools” directly.

You can also echo those Content Mirror Variables using a shortcode like this:

[contentmirrorvar name=lookdifferent]

- That will display true, in this case.

Write Shortcodes, Plugins and Themes compatible with Content Mirror

When writing php-code you can detect whether the actual content you’re generating is inside a Content Mirror or not, by using the global $content_is_mirror like this:

global $content_is_mirror;

if ( isset ( $content_is_mirror ) && $content_is_mirror === true ) {
    // We are inside a content mirror!
    // Do your thing here
    echo 'You've doubled me!';
}

You can also get the Content Mirror Variables thru code like this:

global $content_mirror_params;

if ( isset ( $content_mirror_params ) &&
     isset ( content_mirror_params['lookdifferent'] ) ) {
    echo content_mirror_params['lookdifferent'];
}

This produces the same result as the shortcode contentmirrorvar above.
If you’re using Content Mirror in a multi-site configuration and want to detect what site the content is mirrored to, you can use the content_mirror_original_blogid-variable, like this:

global $content_mirror_original_blogid;

$this_site_name = get_option( 'blogname' );
$visitor_site_name = get_blog_option( $content_mirror_original_blogid, 'blogname' );
echo 'You might think you're visiting ' . $visitor_site_name;
echo 'But infact, you're reading ' . $this_site_name;
echo ' - Greetings!';

More advanced usage

Put this code in functions.php if you want the content-mirror only to get content that is wrapped inside a certain class-name. This example only copies content that is inside a div-tag with class name ‘only_mirror_this’

add_filter('content_mirror_output', 'my_content_mirror_output',10,5);

function my_content_mirror_output ( $post_content, $site, $post_type, 
                                                  $item, $post_item ) {
	$class_name = 'only_mirror_this';
	$filtered_output = '';
	$dom = new DOMDocument;
	@$dom->loadHTML($post_content);
	$xpath = new DOMXPath($dom);
	$entries = $xpath->query('//div[contains(@class,"' . $class_name. '")]');
	foreach ( $entries as $entry ) {
		$filtered_output.= $entry->ownerDocument->saveXML($entry);
	}
	if ( $filtered_output != '' ) $post_content = $filtered_output;
	return $post_content;
}

License

This plugin is released under the GPL, you can use it free of charge on your personal or commercial site. But every small donation for the time I’ve spent writing and supporting this plugin is very appreciated.