有问题,我不明白我做错了什么..
我想获取WordPress中其他功能的功能价值..
此代码替换了代码的某些部分..
我想获取参数变量 words 的值(它需要 $attr['words']),然后使用其他函数(new_quote)。
    <?php
    /*
    * Plugin Name: Random Quotes
    */
    function random_quote($atts) {
        extract( shortcode_atts( array(
        'path' => plugin_dir_path(__FILE__).'quotes.txt',// default, if not set
        'label_new' => 'New Quote',
        'words' => 'no'   // yes or no 
        ), $atts ) );
        $temp = $attr['words']; // no
        ...
    }
    add_shortcode('randomquotes','random_quote');
    function new_quote(){
    global $temp;  // NULL
    /*
    global $attr;
    $temp = $attr['words']; // again NULL
    */
        ...
        if($temp == "no") {
        ...
        }
    }
   ...
?>
我究竟做错了什么?也许只是无法获得这个变量的值?