'widget_aside', 'description' => __('Display some page-related content in a sidebar')); $control_ops = array('width' => 400, 'height' => 350); $this->WP_Widget('aside', __('Aside'), $widget_ops, $control_ops); } function widget( $args, $instance ) { global $post; extract($args); if (!function_exists('widget_parse')) { function widget_parse($text) { ob_start(); eval('?>' . $text); $text = ob_get_contents(); ob_end_clean(); return($text); } } if (is_array($asides = get_post_meta($post->ID, 'aside'))) { foreach ($asides as $aside) { if (strlen($aside) > 0) { switch ($aside[0]) { case '#' : case '!' : $parts = explode(',', $aside); $prefix = ""; $suffix = ""; switch (count($parts)) { case 3 : $prefix = ($instance['parse'])?widget_parse($parts[1]):$parts[1]; $suffix = ($instance['parse'])?widget_parse($parts[2]):$parts[2]; case 1 : switch ($parts[0][0]) { case '#' : $id = substr($parts[0], 1); if ((ctype_digit($id)) && ($page = get_page($id))) { $aside = "
/>
Specify output for this widget by including a custom field named 'aside' in a post/page
ID, 'aside'))) { foreach ($asides as $aside) { if ((strlen($aside) > 2) && ($aside[0] == '!') && ($aside[1] != '!')) { $parts = explode(',', $aside); $id = substr($parts[0], 1); $text = preg_replace("/\<(div|DIV)([[:space:]])+(id|ID)=(\"|')" . $id . "(\"|')/s", "