WordPress 5.2.4
Я создал плагин здесь: ftp: //mysite.com: 21 / ved.rf / public_html / wp-content / plugins/news-vs-other/news_vs_other.php
Это учебная задача. Я хотел бы показать все категории. Идея такова: взять существующий класс, создать дочерний класс и вызвать открытый метод родителя. Но я даже не могу импортировать необходимый класс. Не могли бы вы дать мне удар здесь?
<?php
/*
Plugin Name: News Categories only
Plugin URI: -
Description: News Categories only
Version: 1.0
Author: N
Author URI: -
*/
include '../../../wp-includes/widgets/class-wp-widget-categories.php';
// Register and load the widget
function news_only_load_widget() {
register_widget( 'news_only_widget' );
}
add_action( 'widgets_init', 'news_only_load_widget' );
// Creating the widget
class News_Only_Widget extends WP_Widget_Categories {
public function __construct() {
$widget_ops = array(
'classname' => 'news_only_widget',
'description' => 'News Only Widget',
);
parent::__construct( 'news_only_widget', 'News Only Widget', $widget_ops );
}
// Creating widget front-end
public function widget( $args, $instance ) {
parent::widget( $args, $instance );
}
} // Class wpb_widget ends here
?>
Traceback
Warning: include(../../../wp-includes/widgets/class-wp-widget-categories.php): failed to open stream: No such file or directory on line 10.