WordPress.org

Plugin Directory

Changeset 591165


Ignore:
Timestamp:
08/28/12 01:19:31 (20 months ago)
Author:
bradparbs
Message:

Added widget & hand cursor on hover

Location:
wptextresizecontrols/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wptextresizecontrols/trunk/init.php

    r590943 r591165  
    1313 
    1414wp_enqueue_script( 
    15   'text.js', $plugin_path .'text.js','jquery'); 
     15  'text.js', $plugin_path .'/text.js','jquery'); 
    1616} 
    1717 
    18 add_action('wp_footer','wpTextResize'); 
     18add_action('wp_head','wpTextResize',6); 
    1919 
    2020add_filter('body_class','wpTextResizeBodyClass'); 
    21  
    2221function wpTextResizeBodyClass($classes) { 
    2322    $classes[] = 'wptextresize'; 
     
    2827    $widget = " 
    2928    <div title='Resize Body Text' class='wpTextResizeControls' style='background-color:lightgray;border-radius:7px;-moz-border-radius:7px;-webkit-border-radius:7px;padding:3px;width:55px;'> 
    30         <a class='increaseFont' title='Increase Font Size' style='font-size:18px;'>A</a><a class='resetFont' title='Reset Font Size' style='font-size:13px;padding-left:10px;'>A</a><a class='decreaseFont' title='Decrease Font Size' style='font-size:10px;padding-left:10px;'>A</a></div>"; 
     29        <a class='increaseFont' title='Increase Font Size' style='font-size:18px;cursor:pointer;' >A</a><a class='resetFont' title='Reset Font Size' style='font-size:13px;padding-left:10px;cursor:pointer;'>A</a><a class='decreaseFont' title='Decrease Font Size' style='font-size:10px;padding-left:10px;cursor:pointer;'>A</a></div>"; 
    3130    return $widget; 
    3231} 
     
    4342    ?> 
    4443    <div title='Resize Body Text' class='wpTextResizeControls' style='background-color:lightgray;border-radius:7px;-moz-border-radius:7px;-webkit-border-radius:7px;padding:3px;width:55px;'> 
    45         <a class='increaseFont' title='Increase Font Size' style='font-size:18px;'>A</a><a class='resetFont' title='Reset Font Size' style='font-size:13px;padding-left:10px;'>A</a><a class='decreaseFont' title='Decrease Font Size' style='font-size:10px;padding-left:10px;'>A</a> 
     44        <a class='increaseFont' title='Increase Font Size' style='font-size:18px;cursor:pointer;'>A</a><a class='resetFont' title='Reset Font Size' style='font-size:13px;padding-left:10px;cursor:pointer;'>A</a><a class='decreaseFont' title='Decrease Font Size' style='font-size:10px;padding-left:10px;cursor:pointer;'>A</a> 
    4645    </div>   
    4746    <? 
     
    5150add_shortcode('wpResize','wpTextResizeControlsWidget'); 
    5251 
     52class wpTextResize extends WP_Widget 
     53{ 
     54  function wpTextResize() 
     55  { 
     56    $widget_ops = array('classname' => 'wpTextResize', 'description' => 'Adds text resizing controls' ); 
     57    $this->WP_Widget('wpTextResize', 'wpTextResize', $widget_ops); 
     58  } 
     59  
     60  function form($instance) 
     61  { 
     62    $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) ); 
     63    $title = $instance['title']; 
     64?> 
     65  <p><label for="<?php echo $this->get_field_id('title'); ?>">Title: <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p> 
     66<?php 
     67  } 
     68  
     69  function update($new_instance, $old_instance) 
     70  { 
     71    $instance = $old_instance; 
     72    $instance['title'] = $new_instance['title']; 
     73    return $instance; 
     74  } 
     75  
     76  function widget($args, $instance) 
     77  { 
     78    extract($args, EXTR_SKIP); 
     79  
     80    echo $before_widget; 
     81    $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']); 
     82  
     83    if (!empty($title)) 
     84      echo $before_title . $title . $after_title;; 
     85  
     86    // WIDGET CODE GOES HERE 
     87    wpTextResizeControls(0); 
     88 
     89    echo $after_widget; 
     90  } 
     91  
     92} 
     93add_action( 'widgets_init', create_function('', 'return register_widget("wpTextResize");') ); 
     94 
     95 
  • wptextresizecontrols/trunk/readme.txt

    r590932 r591165  
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html 
    1010 
    11 wpTextResize is an easy to use template tag to generate Increase, Decrease, reset font size controls for body text on a WordPress site. 
     11wpTextResize is an easy to use way to have Increase, Decrease, reset font size controls for body text on a WordPress site. 
    1212 
    1313== Description == 
    14 wpTextResize is an easy to use template tag to generate Increase, Decrease, reset font size controls for body text on a WordPress site. 
     14wpTextResize is an easy to use way to have Increase, Decrease, reset font size controls for body text on a WordPress site. 
    1515 
    16 Just use the [wpResize] shortcode wherever you want the controls to show up. 
     16Just use the [wpResize] shortcode wherever you want the controls to show up. Or use the widget to place it in a sidebar. 
    1717 
    18 You can also add wpTextResizeControls(0) to your template for the controls to be automatically styled, or wpTextResizeControls(1) to manually style. When manually styling, wpTextResizeControls is the container, and increaseFont, resetFont, and decreaseFont are all anchors you can target. 
     18Theme creators: You can also add wpTextResizeControls(0) to your template for the controls to be automatically styled, or wpTextResizeControls(1) to manually style. When manually styling, wpTextResizeControls is the container, and increaseFont, resetFont, and decreaseFont are all anchors you can target. 
    1919 
    2020Go wild! 
     
    25252. Activate the plugin through the 'Plugins' menu in WordPress 
    26263. Add the [wpResize] shortcode wherever you want the controls to appear. 
    27 4. OR Add wpTextResizeControls(0) to your template for the controls to be automatically styled, or wpTextResizeControls(1) to manually style. When manually styling, wpTextResizeControls is the container, and increaseFont, resetFont, and decreaseFont are all anchors you can target. 
     274. You can also use the widget to place it in a sidebar. 
     285. OR Add wpTextResizeControls(0) to your template for the controls to be automatically styled, or wpTextResizeControls(1) to manually style. When manually styling, wpTextResizeControls is the container, and increaseFont, resetFont, and decreaseFont are all anchors you can target. 
    2829 
    2930== Changelog == 
     
    3132= 1.5 = 
    3233 
     34* Added a widget 
     35* When hover over one of the controls, the cursor changes to a hand 
    3336* Bug fixes 
    3437 
Note: See TracChangeset for help on using the changeset viewer.