Connecting the plugin class to functions.php
I want to modify the plugin by adding a method to the class function.php how do I do this?
It didn't work out that way
вот так сделал поправил эту строку
require_once $_SERVER['DOCUMENT_ROOT']."/wp-content/wp-recall/add-on/top-user-by-rating/class/Tub_Rating.php";
add_shortcode('top_user_rating2', 'rcl_top_user_by_rating2');
function rcl_top_user_by_rating2($atts) {
//Параметры шорткода
$atts = shortcode_atts(array(
'templates' => 'block',
'sorting' => '1',
'limit' => '50',
'day' => '30',
'exclude' => '',
'type' => '',
'period' => '',
'paged' => '',
'role' => '',
'cache_time' => '86400'
), $atts);
тут объявил экземпляр класа
$tubrating = new Tub_Rating($atts);
тут присвоил функцию
$tubrating->getTopUserHtml2 = function() {
return $result;
};
return $tubrating->getTopUserHtml2();
}
Connecting the plugin class
require(":/wp-content/wp-recall/add-on/class/Tub_Rating.php");
So I can't connect
require(): Failed opening required '/wp-content/wp-recall/add-on/class/Tub_Rating.php' (include_path='.:/opt/php71/share/pear')
So too
require_once $_SERVER['DOCUMENT_ROOT']."/wp-content/wp-recall/add-on/class/Tub_Rating.php"
0
Author: genrich1993, 2020-09-21