__construct(); } function __construct(){ if (strpos($_SERVER['REQUEST_URI'], 'post.php') || strpos($_SERVER['REQUEST_URI'], 'post-new.php') || strpos($_SERVER['REQUEST_URI'], 'page-new.php') || strpos($_SERVER['REQUEST_URI'], 'page.php')) { if (function_exists('wp_enqueue_script')) { wp_enqueue_script( 'ALTP_js', ALTP_url.'/js/altp.js', '', 1.0 ); } } add_action( 'admin_init', array( &$this, 'add_links_to_pages_add_meta_boxes' ) ); add_action( 'save_post', array( &$this, 'add_links_to_pages_meta_box_save_data' ), 1, 2 ); add_action( 'widgets_init', create_function('', 'return register_widget("altp_Widget");') ); } function add_links_to_pages_add_meta_boxes() { add_meta_box( 'add_links_to_pages_meta_box', __( 'Add links'), array( &$this, 'add_links_to_pages_meta_box' ), 'page' , 'side', 'high' ); } function add_links_to_pages_meta_box(){ global $post; ?>

The url of the destination link.

Whether or not to have the link open in a new window/tab when clicked.

The text displayed to the visitor.

Add an optional description for the link.



'altp_widget', 'description' => 'Display the links you have added to a page.' ); $this->WP_Widget('altp_widget', 'Add links to page', $widget_ops); } function widget($args, $instance) { global $post; if(get_post_meta($post->ID, 'altp_links_html', true) != ''){ extract($args, EXTR_SKIP); echo $before_widget; $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']); if ( !empty( $title ) ) { echo $before_title . $title . $after_title; }; echo html_entity_decode( get_post_meta($post->ID, 'altp_links_html', true) ); echo $after_widget; } } function update($new_instance, $old_instance) { $instance = $old_instance; $instance['title'] = strip_tags($new_instance['title']); return $instance; } function form($instance) { $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) ); $title = strip_tags($instance['title']); ?>