Guest User

Untitled

a guest
Jan 23rd, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. add_action( 'widgets_init', 'wfm_first_widget' );
  2.  
  3. function wfm_first_widget(){
  4. register_widget( 'WFM_Widget' );
  5. }
  6.  
  7. class WFM_Widget extends WP_Widget{
  8.  
  9. function __construct(){
  10. /*parent::__construct(
  11. // ID, name, args (description)
  12. 'wfm_fw',
  13. 'Мой первый виджет',
  14. array( 'description' => 'Описание виджета' )
  15. );*/
  16. $args = array(
  17. 'name' => 'Мой первый виджет',
  18. 'description' => 'Описание виджета',
  19. 'classname' => 'wfm-test'
  20. );
  21. parent::__construct('wfm_fw', '', $args);
  22. }
  23.  
  24. function widget(){
  25.  
  26. }
  27.  
  28. function form($instance){
  29. extract($instance);
  30. ?>
  31.  
  32. <p>
  33. <label for="<?php echo $this->get_field_id('title') ?>">Заголовок:</label>
  34. <input type="text" name="<?php echo $this->get_field_name('title') ?>" id="<?php echo $this->get_field_id('title') ?>" value="<?php if( isset($title) ) echo esc_attr( $title ); ?>" class="widefat">
  35. </p>
  36.  
  37. <?php
  38. }
  39.  
  40. }
Add Comment
Please, Sign In to add comment