diff --git a/argo-link-roundups-widget.php b/argo-link-roundups-widget.php new file mode 100644 index 0000000..f0d9156 --- /dev/null +++ b/argo-link-roundups-widget.php @@ -0,0 +1,108 @@ + 'argo-link-roundups', + 'description' => 'Show your most recent link roundups in the sidebar', 'argo-links' + ); + $this->WP_Widget( 'argo-link-roundups-widget', __('Argo Link Roundups Widget', 'argo-links'), $widget_ops); + } + + function widget( $args, $instance ) { + extract( $args ); + $title = apply_filters('widget_title', $instance['title'] ); + + echo $before_widget; + + if ( $title ) + echo $before_title . $title . $after_title;?> + + get_option( 'sticky_posts' ), + 'showposts' => $instance['num_posts'], + 'exceprt' => $instance['show_excerpt'], + 'post_type' => 'post', + 'post_status' => 'publish' + ); + $my_query = new WP_Query( $query_args ); + if ( $my_query->have_posts() ) { + while ( $my_query->have_posts() ) : $my_query->the_post(); + $custom = get_post_custom($post->ID); ?> +
' . get_the_excerpt() . '
'; + + echo $output; + ?> + ++ + +
+ ++ + +
+ + +More Link
+ + +
+ ++ + +
+ + get('suppress_filters')) return; @@ -44,9 +44,9 @@ function my_get_posts( $query ) { } } } - + /*Register the Argo Links post type */ - function register_post_type() { + public static function register_post_type() { $argolinkroundups_options = array( 'labels' => array( 'name' => 'Link Roundups', @@ -65,6 +65,7 @@ function register_post_type() { 'supports' => array( 'title', 'editor','author','thumbnail','excerpt','trackbacks','custom-fields','comments','revisions','page-attributes','post-formats'), 'public' => true, 'menu_position' => 7, + 'menu_icon' => 'dashicons-list-view', 'taxonomies' => apply_filters('argolinkroundups_taxonomies', array('category','post_tag')), 'has_archive' => true, ); @@ -73,14 +74,14 @@ function register_post_type() { } register_post_type('argolinkroundups', $argolinkroundups_options); } - + /*Tell Wordpress where to put our custom fields for our custom post type*/ - function add_custom_post_fields() { + public static function add_custom_post_fields() { add_meta_box("argo_link_roundups_roundup", "Recent Roundup Links", array(__CLASS__,"display_custom_fields"), "argolinkroundups", "normal", "high"); } /*Show our custom post fields in the add/edit Argo Link Roundups admin pages*/ - function display_custom_fields() { + public static function display_custom_fields() { ?>- 'argo-links', + 'description' => 'Show your most recently saved links in a sidebar widget', 'argo-links' + ); + $this->WP_Widget( 'argo-links-widget', __('Argo Links Widget', 'argo-links'), $widget_ops); + } + + function widget( $args, $instance ) { + extract( $args ); + $title = apply_filters('widget_title', $instance['title'] ); + + echo $before_widget; + + if ( $title ) + echo $before_title . $title . $after_title;?> + + get_option( 'sticky_posts' ), + 'showposts' => $instance['num_posts'], + 'post_type' => 'argolinks', + 'post_status' => 'publish' + ); + $my_query = new WP_Query( $query_args ); + if ( $my_query->have_posts() ) { + while ( $my_query->have_posts() ) : $my_query->the_post(); + $custom = get_post_custom($post->ID); ?> + +
' . __('Source: ', 'argo-links') . ''; + echo ( isset( $custom["argo_link_url"][0] ) ) ? '' . $custom["argo_link_source"][0] . '' : $custom["argo_link_source"][0]; + echo '
'; + } + ?> + ++ + +
+ ++ + +
+ + ++ + +
+ + +More Link
+ + +
+ ++ + +
+ + array( 'name' => 'Argo Links', @@ -80,27 +84,28 @@ function register_post_type() { 'not_found_in_trash' => 'No Argo Links found in Trash', ), 'description' => 'Argo Links', - 'supports' => array( 'title' ), + 'supports' => array( 'title', 'thumbnail' ), 'public' => true, - 'publicly_queryable' => false, 'menu_position' => 6, + 'menu_icon' => 'dashicons-admin-links', 'taxonomies' => array(), + 'has_archive' => true ) ); } /*Tell Wordpress where to put our custom fields for our custom post type*/ - function add_custom_post_fields() { + public static function add_custom_post_fields() { add_meta_box("argo_links_meta", "Link Information", array(__CLASS__,"display_custom_fields"), "argolinks", "normal", "low"); } /*Register our custom taxonomy*/ - function register_argo_links_taxonomy() { + public static function register_argo_links_taxonomy() { register_taxonomy("argo-link-tags", array("argolinks"), array("hierarchical" => false, "label" => "Link Tags", "singular_label" => "Link Tag", "rewrite" => true)); } /*Show our custom post fields in the add/edit Argo Links admin pages*/ - function display_custom_fields() { + public static function display_custom_fields() { global $post; $custom = get_post_custom($post->ID); if (isset($custom["argo_link_url"][0])) { @@ -129,7 +134,7 @@ function display_custom_fields() { } /*Save the custom post field data. Very important!*/ - function save_custom_fields($post_id) { + public static function save_custom_fields($post_id) { if (isset($_POST["argo_link_url"])){ update_post_meta((isset($_POST['post_ID']) ? $_POST['post_ID'] : $post_id), "argo_link_url", $_POST["argo_link_url"]); @@ -143,7 +148,7 @@ function save_custom_fields($post_id) { } /*Create the new columns to display our custom post fields*/ - function display_custom_columns($columns){ + public static function display_custom_columns($columns){ $columns = array( "cb" => "", "title" => "Link Title", @@ -157,7 +162,7 @@ function display_custom_columns($columns){ } /*Fill in our custom data for the new columns*/ - function data_for_custom_columns($column){ + public static function data_for_custom_columns($column){ global $post; $custom = get_post_custom(); @@ -185,19 +190,19 @@ function data_for_custom_columns($column){ } /*Add the Argo Link This! sub menu*/ - function add_argo_this_sub_menu() { + public static function add_argo_this_sub_menu() { add_submenu_page( "edit.php?post_type=argolinks", "Argo Link This!", "Argo Link This!", "edit_posts", "argo-this", array(__CLASS__, 'build_argo_this_page' ) ); } /*Custom page for people to pull the Argo Link This! code from (similar to Press This!)*/ - function build_argo_this_page() { + public static function build_argo_this_page() { ?>Argo Link This! is a bookmarklet: a little app that runs in your browser and lets you grab bits of the web.
- +Use Argo Link This! to clip links to any web page. Then edit and add more straight from Argo Link This! before you save or publish it in a post on your site.
Drag-and-drop the following link to your bookmarks bar or right click it and add it to your favorites for a posting shortcut.
@@ -205,11 +210,19 @@ function build_argo_this_page() {If your bookmarks toolbar is hidden: copy the code below, open your Bookmarks manager, create new bookmark, type Press This into the name field and paste the code into the URL field.