My debug.log has the following message that points to /wp-includes/shortcodes.php on line 319, which is part of WordPress core and probably isn’t where the real error is in the code.
PHP Deprecated: Non-static method RSSjbClass::RSSjb_funct() should not be called statically in /.../wp-includes/shortcodes.php on line 319
I’ve looked at line 319 and it doesn’t help me find or solve the problem. I searched the code and found this with the Class and funct but I don’t know what is non-static being called statically.
/**
* Add shortcode to wordpress
*/
// add_shortcode('RSSjb', 'RSSjb_funct');
add_shortcode('RSSjb', array('RSSjbClass', 'RSSjb_funct'));
/**
* Shortcode Class and Function
*/
class RSSjbClass {
function RSSjb_funct($atts) {
extract(shortcode_atts(array(
// attributes for Google News
"gsearch" => '',
"topic" => '',
"location" => '',
"geo" => '',
"feed" => '', // required
"filter" => '',
"num" => '5',
"ltime" => '',
"list" => 'ul',
"target" => '_blank',
"pubdate" => 'false',
"pubtime" => 'false',
"dformat" => get_option('date_format'),
"tformat" => get_option('time_format'),
"pubauthor" => 'true',
"excerpt" => 'false',
"charex" => '',
"chartle" => '',
"title" => '',
"link" => 'false',
"sort" => 'false',
"cachefeed" => '3600'
), $atts));
followed by several “ifs” and then
// call the function to read and display the feed items list
return $tle . rssjb_List($feed, $filter, $num, $ltime, $list, $target, $pubdate, $pubtime, $dformat, $tformat, $pubauthor, $excerpt, $charex, $chartle, $sort, $cachefeed);
} else {
return '<br>RSS or Atom Feed URL not provided. This shortcode does require the attribute feed or location (if Google News).<br /> Ex: <code>[RSSjb feed = "http://your-rss-or-atom-feed-URL-here"]</code>.';
}
}
}
How do I modify that to fit with what is in /wp-includes/shortcodes.php line 319, which is:
$output = $m[1] . call_user_func( $shortcode_tags[ $tag ], $attr, $content, $tag ) . $m[6];
/**
* Filters the output created by a shortcode callback.
*
* @since 4.7.0
*
* @param string $output Shortcode output.
* @param string $tag Shortcode name.
* @param array|string $attr Shortcode attributes array or empty string.
* @param array $m Regular expression match array.
*/
return apply_filters( 'do_shortcode_tag', $output, $tag, $attr, $m );
}
I searched the PHP Manual and it doesn’t have anything about shortcodes.