如何仅在帖子上显示作者姓名 - Wordpress

时间:2016-02-26 08:17:31

标签: php wordpress wordpress-theming

这段代码可能要小一些,但我似乎无法弄明白。

这就是我想要的:

[when the visitor is on a post]
Written by: the magnificent author of this piece

[When the visitor is on anything else then a post] 
...... (nothing here)

简单地说:

  

这是标题!!

     

由伟大的作者撰写(我只想在帖子上展示,而不是在>页面或任何其他页面上展示)

     

然后,文章中的文字正常显示。无论如何   作者是否出现。

这是我到目前为止的代码......

<?php

if (is_single() || is_page()) {
    while (have_posts()):
        the_post();

        # page + post
        wikiwp_get_thumbnail($post);

        # post only
        if (is_single()) {
?>
                            <?php
                            _e('<p>Written by:', 'wikiwp');
                            echo '&nbsp;';
                            the_author_posts_link();
                            ?>
<?php
        } else if (is_page()) {
Stuff that is shown when they are on a page
?>
<?php
        }
    endwhile;
} else {
The stuff that is shown when they are on anything else
?>
<?php
}
?>
The text of the article......

我很确定上面的代码没有任何意义......但我有限的PHP经验并没有真正帮助大声笑。

0 个答案:

没有答案
相关问题