Что делать и как быть?
PHP:
скопировать код в буфер обмена
скопировать код в буфер обмена
- <?PHP
- add_action( 'widgets_init', 'Get_Advertising' );
- function Get_Advertising() {
- register_widget( 'Get_Advertising' );
- }
- class Get_Advertising extends WP_Widget {
- function Get_Advertising() {
- $this->WP_Widget( 'advertising_widget', __('Реклама'), $widget_ops, $control_ops );
- }
- function widget( $args, $instance ) {
- //Our variables from the widget settings.
- $link_site = $instance['link_site'];
- $link_img = $instance['link_img'];
- echo $before_widget;
- // Выводим картинку
- if ( $link_img)
- echo $after_widget;
- }
- //Обновление виджета
- function update( $new_instance, $old_instance ) {
- $instance = $old_instance;
- //Strip tags from title and name to remove HTML
- return $instance;
- }
- function form( $instance ) {
- //Устанавливаем параметры по умолчанию.
- $defaults = array( 'link_site' => __('http://mizter.ru/', 'example'), 'link_img' => __('http://lbrtrz.artlab.tk/wp-content/uploads/2013/01/468x601.png', 'example') );
- <p>
- <label for="<?PHP echo $this->get_field_id( 'link_site' ); ?>"><?PHP _e('Ссылка на сайт:'); ?></label>
- <input id="<?PHP echo $this->get_field_id( 'link_site' ); ?>" name="<?PHP echo $this->get_field_name( 'link_site' ); ?>" value="<?PHP echo $instance['link_site']; ?>" style="width:80%;" />
- </p>
- <p>
- <label for="<?PHP echo $this->get_field_id( 'link_img' ); ?>"><?PHP _e('Ссылка на картинку:'); ?></label>
- <input id="<?PHP echo $this->get_field_id( 'link_img' ); ?>" name="<?PHP echo $this->get_field_name( 'link_img' ); ?>" value="<?PHP echo $instance['link_img']; ?>" style="width:80%;" />
- </p>
- <?PHP
- }
- }
- ?>