Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(function_exists('register_sidebar')) {
- register_sidebar(
- array(
- 'name' => __('Main Sidebar'),
- 'id' => 'main-sidebar',
- 'description' => __('The main sidebar area'),
- 'before_widget' => '<div class="widget">',
- 'after_widget' => '</div>',
- 'before_title' => '<h2>',
- 'after_title' => '</h2>'
- ));
- }
- /****************************************************/
- /* Load Custom Widgets */
- /***************************************************/
- require_once('functions/rh_tags.php');
- <?php
- class RH_Tags extends WP_Widget {
- function __construct() {
- $params = array(
- 'name' => 'Creative : Tag Cloud Widget',
- 'description' => 'Displays info of your blog'
- );
- parent:: __construct('RH_Tags','',$params);
- }
- public function form($instance) {
- //display our form in widget page
- extract($instance);
- ?>
- <p>
- <label for="<?php echo $this->get_field_id('title') ?>">Title : </label>
- <input class="widefat" id="<?php echo $this->get_field_id('title') ?>" name="<?php echo $this->get_field_name('title') ?>"
- value="<?php if(isset($title)) echo esc_attr($title); ?>" />
- </p>
- <?php
- }
- public function widget($args,$instance) {
- //displays our widget
- extract($args);
- extract($instance);
- echo $before_widget;
- echo $before_title .$title. $after_title;
- echo '<div class="label">';
- echo "<ul>";
- echo "<li>";
- echo the_tags(' ',' ');
- echo "</li>";
- echo "</ul>";
- echo '</div>';
- echo $after_widget;
- }
- }
- add_action('widgets_init','rh_register_tags');
- function rh_register_tags() {
- register_widget('RH_Tags');
- }
- function get_the_terms( $post, $taxonomy ) {
- if ( ! $post = get_post( $post ) )
- return false;
- $terms = get_object_term_cache( $post->ID, $taxonomy );
- if ( false === $terms ) {
- $terms = wp_get_object_terms( $post->ID, $taxonomy );
- wp_cache_add($post->ID, $terms, $taxonomy . '_relationships');
- }
- public function( Array $args )
- {
- $foo = isset( $args['foo'] )
- ? $args['foo']
- : 'my default';
- // work with `$foo`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement