Wordpress替代使用GET?

时间:2012-07-30 15:41:15

标签: php wordpress

我目前有一个插件,显示为我的网站写博客的作者的图像。

插件如下:

function display_authors() {
    global $wpdb;
    $authors = $wpdb->get_results("SELECT * from $wpdb->users ORDER BY display_name");


    $output = '<ul id="authors">';

    foreach($authors as $author) {

        if($author->display_name != 'admin')
        {
            // display user image for each author
            $output .=  '<li class="author" id="author-'.$author->ID.'">';
            // userphoto function echoes image HTML rather than returning it
            $output .= userphoto($author->ID);
            $output .= '</li>';
        }
    }   

    $output .= '</ul>';

    echo $output;
}

add_shortcode('oe-list-authors', 'display_authors');

我想知道的是如何链接到我将展示作者的元内容及其最新帖子等的页面。

我希望这是同一页面,因为它需要在导航栏中具有相同的父级。

通常在PHP中,您可以检查是否有GET变量集,以便您可以显示作者列表以及随之而来的页面内容,或者特定作者的个人资料信息,但我我不知道如何在Wordpress的范围内做到这一点,我真的很感激一些帮助。

1 个答案:

答案 0 :(得分:1)

我可能错了,但我认为您仍然可以使用$_GET['varname']

访问GET变量

参见本页:

http://wordpress.org/support/topic/using-custom-_get-variables-with-templates-and-permalinks

你有没有尝试过:

$whatever = $_GET['somevar'];