Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End WordPress Code Help

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #45649
    Rohithzr
    Participant

    I am new to WordPress Development and my client has asked me to create a ‘fake’ recent activity bar like one in [meritnation](http://meritnation.com “Meritnation”).

    So I thought it should not be tough created this out line :

    Aim:

    ‘Rohit Hazra’ is reading ‘Algebra Paper’.
    on ‘Current_Time’

    Methodology:

    a never ending loop with randomized ‘$ID’ for post and members.

    a ‘if’ check in Session for current $user_id and skip the id in ‘for’ loop.

    echo the variables and text.

    But frankly I dont know how to that on WordPress

    Please Help me out.

    #139357
    pixelgrid
    Participant

    wordpress cant autoupdate your code once is send as html. all it does is construct your page based on posts comments etc.

    what you could do is get all the users with get users
    http://codex.wordpress.org/Function_Reference/get_users

    get all the posts with a custom loop excluding categories or including only the ones you want,

    and them create div with the name and article as you described before. absolutely position them and handle the ‘updading’ with changing the top value of teh next ‘activity’ throught javascript

    #139359
    Rohithzr
    Participant

    @pixelgrid i do not care about the ‘animation’ part the thing is as i said i am new to wp coding and am unable to work around it.

    if you can give me a sample custom code with just displaying a few users and tell me how to implement it then it would be quite helpful.

    #139361
    pixelgrid
    Participant

    $blogusers = get_users(‘blog_id=1&orderby=nicename&role=subscriber’);
    $categories = get_categories();
    foreach ($blogusers as $user) {
    echo ‘div class=”activity”>’ . $user->user_nicename . ‘ is reading ‘.array_rand($categories)->cat_name.’‘;
    }

    this is just a quick example to get you started i have not tested it

    #139366
    Rohithzr
    Participant

    THANKS TRYING ON

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘Back End’ is closed to new topics and replies.