Anecdata.org! Version: 1.0.3 Author: Anecdata Author URI: http://www.anecdata.org License: GPL2 */ /** Copyright 2015 Duncan Bailey (email : dbailey@mdibl.org) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ // Creating the widget class anecdata_sidebar_photo_widget extends WP_Widget { function __construct() { parent::__construct( // Base ID of your widget 'anecdata_sidebar_photo_widget', // Widget name will appear in UI __('Anecdata Project Photos', 'anecdata_sidebar_photo_widget_domain'), // Widget description array( 'description' => __( 'Recent photos from your Anecdata project', 'anecdata_sidebar_photo_widget_domain' ), ) ); add_action( 'wp_enqueue_scripts', array( $this, 'register_plugin_scripts' ) ); add_action( 'wp_enqueue_scripts', array( $this, 'register_plugin_styles' ) ); } public function register_plugin_scripts() { wp_enqueue_script('jquery'); } public function register_plugin_styles() { wp_register_style( 'anecdata_sidebar_photo_widget', plugins_url( 'anecdata-project-photos-widget/style.css' ) ); wp_enqueue_style( 'anecdata_sidebar_photo_widget' ); } // Creating widget front-end // This is where the action happens public function widget( $args, $instance ) { $title = apply_filters( 'widget_title', $instance['title'] ); // before and after widget arguments are defined by themes echo $args['before_widget']; if ( ! empty( $title ) ) echo $args['before_title'] . $title . $args['after_title']; // This is where you run the code and display the output ?>
E.g. "http://www.anecdata.org/projects/view/59".
Don't have a project yet? Create one now.