WordPress.org

Ready to get started?Download WordPress

Forums

Filter by User Name (1 post)

  1. Marlimant
    Member
    Posted 1 year ago #

    Hello:

    I have a link that varies by user.
    For now, it is work filtering by user id, but I need the code filter by username.

    My actual code is:

    <?php $user_id = get_current_user_id();
    if ($user_id == 6) {
    echo '<a title="Download" href="http://www.mypage.cl/any_url-A/" rel="nofollow">';
    } else {
    echo '<a title="Download" href="http://www.mypage.cl/any_url-B/" rel="nofollow">';}?>
    <img src="http://www.mypage.cl/my_image-gif/" width="250" height="48" />
    </a>
    <?php global $post; $myposts = get_posts('numberposts=1&category_name=download'); foreach($myposts as $post) : setup_postdata($post);
     the_content();
     if(has_post_thumbnail()) {the_post_thumbnail();}
     endforeach; ?>

    Thank you!

Topic Closed

This topic has been closed to new replies.

About this Topic