douzoudang1511 2015-01-08 20:36
浏览 72

如何在wordpress author的个人资料中添加关注功能?

is there any way to add "follow" functionality to Wordpress ? so that every logged-in user can follow his favorite author and only can see post from authors that he followed them .. Mr Ryan "A programmer in wordpress forums" told me that i can do this with the following idea :

A possible solution would be that if a logged-in user (call it user #1) is clicking "follow" on another user's profile (call it user #2), you record user #2's ID as meta data on user #1. You can do this via the update_user_meta function. You can then retrieve posts from user #2 by using WP_Query with an author parameter. The author parameter can be an array, so you can get the posts of multiple users that way

and maybe if we make this idea as a function called : "is_followed" which return True and False Then we can use it in index.php page in the following line :

    <?php endif; ?>
    <?php if( have_posts() ) : ?>
        <div class="entries">
            <?php while( have_posts()  ) : the_post(); ?>
                <?php get_template_part( 'content', get_post_format() ); ?>
            <?php endwhile; ?>
        </div><!-- .entries -->

to be something like this

<?php endif; ?>
<?php if( have_posts() ) : ?>
    <div class="entries">
        <?php while( have_posts() & is_followed  ) : the_post(); ?>
            <?php get_template_part( 'content', get_post_format() ); ?>
        <?php endwhile; ?>
    </div><!-- .entries -->

Sorry I don't know how to write codes :(

I found a free plugin called: "User profiles" that can create a profile for each author: https://wordpress.org/plugins/user-profile/ so that we can put the follow button in it :/

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 Macbookpro 连接热点正常上网,连接不了Wi-Fi。
    • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
    • ¥15 linux驱动,linux应用,多线程
    • ¥20 我要一个分身加定位两个功能的安卓app
    • ¥15 基于FOC驱动器,如何实现卡丁车下坡无阻力的遛坡的效果
    • ¥15 IAR程序莫名变量多重定义
    • ¥15 (标签-UDP|关键词-client)
    • ¥15 关于库卡officelite无法与虚拟机通讯的问题
    • ¥15 目标检测项目无法读取视频
    • ¥15 GEO datasets中基因芯片数据仅仅提供了normalized signal如何进行差异分析