我有这段代码,我正在使用它创建自定义作者。php,它可以很好地显示用户的帖子及其子对象等:
<?php get_header(); ?>
<?php $curauth = (isset($_GET[\'author_name\'])) ? get_user_by(\'slug\', $author_name) : get_userdata(intval($author)); ?>
<div class="auth-name">
<?php if ( \'\' != get_the_author_meta( \'user_description\' ) ) echo apply_filters( \'archive_meta\', get_the_author_meta( \'display_name\' )); ? >
</div>
<div class="auth-desc">
<?php if ( \'\' != get_the_author_meta( \'user_description\' ) ) echo apply_filters( \'archive_meta\', get_the_author_meta( \'user_description\' )); ?>
</div>
<div class="header">
<h1>Buckets made (<?php $children = get_posts( array( \'author\' => $curauth->ID, \'category_name\' => \'Bucket\', ) ); echo count($children);?>) </h1>
<a href="/add-a-bucket"><span class="big-bucket"> Add a new bucket</span></a>
</div>
</div>
<div class="content">
<ul class="stash-container">
<?php
$args = array( \'post_type\' => \'bucket\',\'post_parent\' => 0 ,\'author\' => $curauth->ID,\'posts_per_page\' => -1 ); ?>
<?php $loop = new WP_Query( $args ); ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<li class="buckets">
<a href="<?php echo get_the_permalink($site->ID); ?>">
<div class="rollover-bucket">
</div>
</a>
<div class="r-text">
<?php do_action(\'gform_update_post/edit_link\', array(
\'post_id\' => $post->ID,
\'url\' => \'http://buckets.me/edit-bucket/\',
\'text\' => \'edit\',
) ); ?>
<?php echo delete_post_bucket($post->ID); ?>
</div>
<div class="empty-state-thumb">
This bucket is empty!
</div>
<div class="display-block">
<?php
global $authordata, $post;
$parent = array( \'post_type\' => \'bucket\',\'post_parent\' => $post->ID, \'post_status\' => \'publish\' ,\'author\' => $curauth->ID,\'posts_per_page\' => -1 );
$my_meta = get_post_meta( $post->ID, \'connect\', true);
$portfolio_sections = array(
\'post_type\' => \'bucket\',
\'author\' => $curauth->ID,
\'category_name\' => \'drop\',
\'orderby\' => \'rand\',
\'posts_per_page\' => 4,
\'post_parent\' => $parent,
\'sort_order\' => \'ASC\',
\'meta_query\' => array(
array(
\'key\' => \'connect\',
\'value\' => $my_meta,
\'compare\' => \'=\' )
)
);
$sections = get_posts($portfolio_sections);
foreach ($sections as $section) { ?>
<img src="http://api.screenshotmachine.com/? key=8d5e59&size=M&format=png&url=<?php echo get_post_meta($section->ID, \'the_url\', true);?>">
<?php } ?>
</div>
<div class="botsy">
<a href="<?php the_permalink(); ?>">
<?php the_title(); ?>
</a>
<div class="botsy-det">
<?php
$cc = get_the_content();
if($cc != \'\') { ?>
<?php $content = get_the_content(); echo mb_strimwidth($content, 0, 96, \'...\');?>
<?php } else { ?>
<div class="empty-lines"></div>
<div class="empty-lines"></div>
<div class="empty-lines"></div>
<?php } ?>
</div>
</div>
</li>
<?php endwhile; ?>
</ul>
<?php get_footer(); ?>
但由于某些原因,用户名和bio没有显示在顶部,我很确定在开发过程中的某个时候它工作得很好,它是一个相互冲突的插件还是我太笨了?
谢谢