我已经为WordPress下载了一个较旧的插件,但是每当我尝试激活它时,都会引发此错误:
致命错误:无法在[filelocation]第41行的写上下文中使用函数返回值
function poa_ps_enqueue_scripts() {
if ( is_category() ) :
$cat = get_category(get_query_var('cat'));
$slides_loop = new WP_Query( array( 'post_type' => POA_POST_TYPE_NAME, 'category__in' => $cat->term_id, 'posts_per_page' => -1, 'order' => 'asc' ) );
if ( !empty($slides_loop) ) :
wp_enqueue_style( 'reveal_preloader_css', POA_PLUGIN_URL . '/css/preloader.css', array(), '2017' );
wp_enqueue_style( 'reveal_css', POA_PLUGIN_URL . '/js/libs/reveal/css/reveal.css', array(), '2017' );
// reveal.js scripts
wp_register_script( 'reveal_js', POA_PLUGIN_URL . '/js/libs/reveal/js/reveal.js', array('jquery'), '3.7.3', '1.0', true );
wp_enqueue_script( 'reveal_js' );
wp_enqueue_style( 'reveal_custom_css', POA_PLUGIN_URL . '/css/poa_style.css', array(), '20160816' );
wp_register_script( 'reveal_speaker_notes_js', POA_PLUGIN_URL . '/js/libs/reveal/plugin/notes/notes.js', array(), null, true );
wp_enqueue_script( 'reveal_speaker_notes_js' );
// reveal.js current config and work
wp_register_script( 'reveal_front_js', POA_PLUGIN_URL . '/js/front-js.js', array(), '3.7.3', true );
// get plugin options from admin page Settings->Presentation Slides
Error-> $autoslide = isset(get_option('poa_option_name')['poa_enable_autoslide']) ? get_option('poa_option_name')['poa_enable_autoslide'] : 0;
$loop = isset(get_option('poa_option_name')['poa_enable_continuous_loop']) ? get_option('poa_option_name')['poa_enable_continuous_loop'] : 0;
$transition = isset(get_option('poa_option_name')['poa_slides_transition']) ? get_option('poa_option_name')['poa_slides_transition'] : 0;
// Localize the script with new data
$php_vars = array(
'enable_autoslide' => intval( $autoslide ),
// 'autoslide_time' => esc_html( of_get_option('reveal_autoslide_time') ),
'loop_presentation' => intval( $loop ),
'transition' => esc_html($transition)
);
wp_localize_script( 'reveal_front_js', 'php_vars', $php_vars );
wp_enqueue_script( 'reveal_front_js' );
if (!empty(get_option('poa_option_name')['poa_position_navigation'])) {
$position = esc_html(get_option('poa_option_name')['poa_position_navigation']);
if ($position == 'left' || $position == 'right') {
wp_enqueue_style( 'position_css', POA_PLUGIN_URL . '/css/poa-position-nav.css', array(), '2017' );
}
}
endif;
endif; //is_category()
}
有人知道我该如何解决? wordpress网站还告诉我我正在运行旧版本的PHP,这是否也可以连接错误?如果可以的话,可以不更新PHP而将其修复吗?