WordPress.org

Support

Support » Themes and Templates » Display different category based on logged in user

Display different category based on logged in user

  • I have set up categories with the same names as my users so each user has its on category with identical names.

    I want to only show that category when the user is logged in, this is the code iv written its my fist attempt at something like this though and im stuck 🙁

    <?php

    global $current_user;
    $user = get_current_user($user->user_login);
    $username = $user['username'];

    ?>

    <?php get_header(); ?>

    <div id="content">
    <?php
    query_posts("cat=$username");
    while (have_posts()) : the_post();
    the_content();
    endwhile;
    ?>
    </div>

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Display different category based on logged in user’ is closed to new replies.
Skip to toolbar