/** * Outputs the HTML for this widget. * * @param array An array of standard parameters for widgets in this theme * @param array An array of settings for this widget instance * @return void Echoes it's output **/ function widget($args, $instance) { $id = CE_AddRoll::get_page_adroll(); extract($args, EXTR_SKIP); echo $before_widget; echo $before_title; echo $instance['title']; // Can set this with a widget option, or omit altogether echo $after_title; echo '<p>'; _e(" Add ads to your site! ", ET_DOMAIN); $url = get_permalink($id); ?> <a href="<?php echo $url; ?> " ><?php _e("Click here", ET_DOMAIN); ?> </a> <?php echo '</p>'; // // Widget display logic goes here // echo $after_widget; }
/** * add script for backend this page. */ function on_add_scripts() { $roll = new CE_AddRoll(); $id = $roll->get_page_adroll(); wp_enqueue_script('ce.iris', CE_ROLL_URL . '/js/colorpicker.js'); wp_enqueue_script('js-roll-backend', CE_ROLL_URL . '/js/roll-backend.js', array('ce', 'jquery', 'backbone', 'underscore')); $url = get_permalink($id); $url = add_query_arg(array('adroll_request' => 1), $url); wp_localize_script('js-roll-backend', 'ce_adroll', array('link' => $url)); }