天仓零 发表于 2008-3-9 22:56

Wordpress显示分类作者插件:Author Complete Post List怎么用

不懂php,wordpress的这个作者list插件不知咋整

上传到插件以后,要修改php代码,不知道该修改哪里。

1.Upload author-complete-post-list.php to the /wp-content/plugins/ directory.
2.Activate the plugin through the ‘Plugins’ menu of WordPress.
3.Place in your templates:
4.For the total of posts: <?php totalposts($author, $curauth->userlogin); ?>
5.For the list of posts: <?php fullpostlist($author, $curauth->user_login); ?>


找不到

4.For the total of posts: <?php totalposts($author, $curauth->userlogin); ?>
5.For the list of posts: <?php fullpostlist($author, $curauth->user_login); ?>

源代码是:

<?php
/*
Plugin Name: Author Complete Post List
Plugin URI: http://www.bombolom.com/weblog/wordpress/PluginAuthorCompletePostList2-2007-11-06-00-35.html
Description: Displays the complete post list (all posts) of one Author including his participations as co-author.
Version: 2.0
Author: José Lopes
Author URI: http://www.bombolom.com/
*/

/*
This plugin displays the complete post list of one Author
including his participations as co-author, with the total number.
*/

/* Copyright 2007 Jose Lopes (email: jose.lopes@paxjulia.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA02111-1307USA
*/
if(function_exists('load_plugin_textdomain'))
      load_plugin_textdomain('author-complete-post-list','wp-content/plugins/author-complete-post-list');
function total_posts ($presentAuthor='', $loginAuthor='', $lang='') {
// This function gets the total of posts for a given Author.

// Constants for the language
$title_01 = __("The author posts are:","author-complete-post-list");
$title_02 = __("The author has", "author-complete-post-list");
$title_03 = __("post(s):", "author-complete-post-list");
// End constants
// initialize var:
$k = 0;
// Get all the existing posts:
query_posts('posts_per_page=-1');

// Loop
if ( have_posts() ) :
while ( have_posts() ) : the_post();

$mainAuthor= get_post($post->ID, ARRAY_A);

if ($mainAuthor == $presentAuthor) {$k++;}
else {
   $other_authors = get_post_custom_values('other_author');
   if ( count($other_authors) < 1 ) continue;
   else {
    if (in_array($loginAuthor, $other_authors, true)){
   $k++;
    }
    else {continue;}
    }
   }
endwhile;
else: continue;
endif;
if ($k == 0) {
echo '<p><b>', $title_01, '</b></p>';
}
else {
echo '<p><b>', $title_02, ' ', $k, ' ', $title_03, '</b></p>';
}
}
function full_post_list ($presentAuthor='', $loginAuthor='', $lang='') {
// Constants for the language
$noPost = __("The author has no post.", "author-complete-post-list");
$stored = __("stored in", "author-complete-post-list");
$time = __("on", "author-complete-post-list");
// End constants
// initialize var:
$k = 0;
// Get all the existing posts:
query_posts('posts_per_page=-1');
if ( have_posts() ) :
while ( have_posts() ) : the_post();

$mainAuthor= get_post($post->ID, ARRAY_A);

if ($mainAuthor == $presentAuthor){
   echo '<p><b>-</b> <a href="', the_permalink();
   echo '" rel="bookmark" title="Permanent Link: ';
   echo the_title();
   echo '">';
   echo the_title();
   echo '</a> ', $time, ' ';
   echo the_time('d/m/Y');
   echo ', ', $stored, ' ';
   echo the_category('&');
   echo '</p>';
   echo "\n";
   echo "\n";
   $k++;
}
else {
   $other_authors = get_post_custom_values('other_author');
   if ( count($other_authors) < 1 ) continue;
   else {
    if (in_array($loginAuthor, $other_authors, true)){
   echo '<p><b>-</b> <a href="', the_permalink();
   echo '" rel="bookmark" title="Permanent Link: ';
   echo the_title();
   echo '">';
   echo the_title();
   echo '</a>', $time;
   echo the_time('d/m/Y');
   echo $stored;
   echo the_category('&');
   echo '</p>';
   echo "\n";
   echo "\n";
   $k++;
    }
    else {continue;}
    }
   }
endwhile;
else: continue;
endif;

if ($k = 0) echo $noPost;
}
?>

aaaa007cn 发表于 2008-3-10 01:18

4.For the total of posts: <?php totalposts($author, $curauth->userlogin); ?>
5.For the list of posts: <?php fullpostlist($author, $curauth->user_login); ?>
这个是写在模版里面的吧
看说明是要编辑theme的author.php
上次那个问题怎么解决的023

天仓零 发表于 2008-3-10 18:00

是修改Author Complete Post List插件的php文件,不是修改模板的吧?

我是问改这个php的哪段?



上次的问题解决方法如下:

用文本编辑器打开wp-includes文件夹下的plugin.php文件,来到大约106行这样(根据版本的不同可能会有误差),找到以下代码:

unset($GLOBALS[’wp_filter’][$tag][$priority]);

替换成:

$wp_filter[$tag][$priority] = array();
unset($wp_filter[$tag][$priority]);

aaaa007cn 发表于 2008-3-10 19:44

http://wordpress.org/extend/plugins/author-complete-post-list/
看说明应该是在后台plugin面板里激活后,在模版的author.php里面用
<?php totalposts($author, $curauth->userlogin); ?>
显示全部post

<?php fullpostlist($author, $curauth->user_login); ?>
显示post列表

好吧,其实我不确定author page到底是哪个页面,之前改过的几个模版都没有独立的author.php文件,不过可以确定这是模版的一部分
Author Templates « WordPress Codex
http://codex.wordpress.org/Author_Templates

那个解决方法。。。其实和这个差不多啊。。。不过比较粗暴。。。
http://wordpress.org/support/topic/118367/page/2#post-649616
页: [1]
查看完整版本: Wordpress显示分类作者插件:Author Complete Post List怎么用