Category Archives: Development

Remove input field focus

[css]
textarea:focus, input:focus{
outline: 0;
}
[/css]
I always forgot this rule & forget to add it to my stylesheets. This is what separates the men from the boys.

WordPress Dynamic Navigation

Sometimes in WordPress you don’t want to use the custom menus for some navigation parts, like sub navigations in sidebars or something. Sometimes custom menus are just over kill, especially if every page has a sub navigation made up of child pages.

Heres an easy way of generating the sub navigations of Parent / Child pages & also showing the Parent page title above it.

WordPress Plugin: Custom Class Text Widget

Every now and then at Inigo Media @Ben_Seven likes to come sit by me and pick through my work finding issues and generally tries to cause me the greatest amount of stress. Yesterday was no different, apart from he had quite a cool idea regarding WordPress widgets.

Currently there is no way to define multiple widgets with the same class – unless you do all or none. @Ben_Seven had the idea of somehow getting a custom class into the widget area while still maintaining the general look/feel & presentation on the front end.

I give to you; Custom Class Text Widget.
[php]
/*
Plugin Name: Custom Class on Text Widgets
Plugin URI: http://www.inigo.net
Description: A customized text widget to give custom classes on each widget area.
Author: Paul @ Inigo
Version: 1.0
Author URI: http://www.inigo.net
*/

class customClassText extends WP_Widget {
function customClassText() {
parent::WP_Widget(‘customclasstext’, $name = ‘Custom Class Text Widget’);
}

function widget($args, $instance) {
extract($args);
$title = apply_filters(‘widget_title’, $instance[‘title’]);
$customClass = apply_filters(‘widget_title’, $instance[‘customClass’]);
$text = $instance[‘text’];

echo ‘

‘.”\n”;
echo $before_widget;
echo $before_title.$title.$after_title;
echo $text;
echo $after_widget;
echo ‘

‘.”\n”;
}

function update($new_instance, $old_instance) {
$instance = $old_instance;
$instance[‘title’] = strip_tags($new_instance[‘title’]);
$instance[‘customClass’] = strip_tags($new_instance[‘customClass’]);
$instance[‘text’] = $new_instance[‘text’];
return $instance;
}

function form($instance) {
if($instance) {
$title = esc_attr($instance[‘title’]);
$customClass = esc_attr($instance[‘customClass’]);
$text = esc_attr($instance[‘text’]);
} else {
$title = __(”, ‘text_domain’);
$customClass = __(”, ‘text_domain’);
$text = __(”, ‘text_domain’);
}

echo ‘

‘;
echo ‘get_field_id(‘text’).'”>’._e(‘Text:’).’‘;
echo ‘