我创建了插件文件夹“my-plugin”,文件名为 my-plugin.php,内容如下。当我尝试打开插件时出现错误:“解析错误:语法错误,第 83 行 (...)\wp-content\plugins\my-plugin\my-plugin.php 中文件意外结束”。这是该文件中的最后一个空行。哪里有问题?<?php/** * @package my_plugin * @version 1.0 *//*Plugin Name: My pluginPlugin URI: http://wordpress.org/extend/plugins/#Description: This is an example pluginAuthor: Your NameVersion: 1.0Author URI: https://yourwebsite.com/*//** * Register a shortcode * * @param array $atts Array of shortcode attributes */function kinsta_get_posts_cb( $atts ){ // safely extract custom arguments and set default values extract( shortcode_atts( array( 'numberposts' => 3, 'post_type' => 'post', 'book_category' => 'fantasy', 'year_published' => 1900, 'price_min' => 0, 'price_max' => 50 ), $atts, 'kinsta_get_posts' ) ); // define the array of query arguments $args = array( 'numberposts' => $numberposts, 'post_type' => $post_type, 'tax_query' => array( array( 'taxonomy' => 'book_category', 'field' => 'slug', 'terms' => $book_category, ) ), 'meta_query' => array( 'relation' => 'AND', 'year_clause' => array( 'key' => 'year_published', 'value' => $year_published, 'type' => 'numeric', 'compare' => '>', ), 'price_clause' => array( 'key' => 'price', 'value' => array( $price_min, $price_max ), 'type' => 'numeric', 'compare' => 'BETWEEN', ) ), 'orderby' => array( 'price_clause' => 'ASC' ) );
添加回答
举报
0/150
提交
取消