呜呜呜!我明白了!我为《创世纪》使用了一个自定义主题,因此您可以在下面的注释中看到其中的一些,但这里是以防任何人想看到它。
在函数中。php
/** Display author box on single posts */
add_filter( \'get_the_author_genesis_author_box_single\', \'__return_true\' );
/** Display author box on archive pages */
add_filter( \'get_the_author_genesis_author_box_archive\', \'__return_true\' );
/** Removes author box after posts */
remove_action(\'genesis_after_post\', \'genesis_do_author_box_single\');
/** Adds author box before content */
add_action(\'genesis_before_post\', \'genesis_do_author_box_single\');
add_action( \'genesis_before_loop\', \'include_contestants_entry\' );
function include_contestants_entry() {
if( is_single() ) {
require(CHILD_DIR.\'/contestants_entry.php\');
}
}
/** Replace the standard loop with our custom loop */
remove_action( \'genesis_loop\', \'genesis_do_loop\' );
add_action( \'genesis_loop\', \'child_do_custom_loop\' );
function child_do_custom_loop() {
global $paged; // current paginated page
global $query_args; // grab the current wp_query() args
$args = array(
\'category__not_in\' => 7, // exclude posts from this category
\'paged\' => $paged, // respect pagination
);
genesis_custom_loop( wp_parse_args($query_args, $args) );
}
然后参赛者进入。php
<!-- This sets the $curauth variable -->
<?php
$curauth = (isset($_GET[\'author_name\'])) ? get_user_by(\'slug\', $author_name) : get_userdata(intval($author));
?>
<div id="contestants">
<!-- The Loop -->
<?php query_posts(\'category_name=contestants&posts_per_page=1\'); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<h2><?php echo $curauth->user_nicename; ?></h2>
<?php the_post_thumbnail(\'medium\', array(\'class\' => \'alignleft\')); ?>
<?php act_last_connect($author) ?></br>
<?php if(function_exists(\'getvote5\')) getvote5(\'get\'); ?></br>
<h2>About Me</h2>
Posted: <?php the_time(\'M. d, Y\'); ?>
<?php the_content(); ?>
<?php endwhile; else: ?>
<p><?php _e(\'This contestant has not created his/her entry.\'); ?></p>
<?php endif; ?>
我仍然需要返回并添加一些在用户注册过程中创建的自定义字段(到competities\\u entry.php中),但我会得到它。