WordPress.org

Ready to get started?Download WordPress

Forums

the_author is empty when not logged in (2 posts)

  1. marianograndioso
    Member
    Posted 1 year ago #

    Is there a reason why the_author should return an empty string on the first page when the user is not logged in, but return the author name just as it should when more posts are loaded through AJAX ?
    The loop is the same in both cases.
    Please help me resolve this issue as I'm clueless and I need it fixed ASAP to launch my site.

    Here's the whole index.php:

    <?php 
    
    get_header();
    get_sidebar();
    
    ?>
    <!-- MAIN DIV -->
    
    			<div id='content_and_floater'>
    
    				<?php get_template_part('social_floater'); ?>
    				<div id='content'>
    					<?php get_template_part('loop'); ?>
    				</div>
    
    			</div>
    
    			<?php get_template_part('loader'); ?>
    
    <!-- MAIN DIV -->
    <?php
    get_footer();
    ?>

    And here's how the infinitePaginator calls the loop in functions.php (the function is called when scrolled down to the bottom or the loader link is clicked):

    function wp_infinitepaginate(){
        $loopFile        = $_POST['loop_file'];
        $paged           = $_POST['page_no'];
        $posts_per_page  = get_option('posts_per_page');  
    
        # Load the posts
        query_posts(array('paged' => $paged ));
        get_template_part( $loopFile );  
    
        exit;
    }

    You can see the behaviour at test.nowillnoskill.net.
    In single posts it's not working either. My guess is that query_posts(array('paged' => $paged )); changed something in the query, but I don't know what is it.
    I tried to insert setup_postdata($post); just after the_post() in loop.php as I found that worked for someone, but it doesn't for me.

  2. marianograndioso
    Member
    Posted 1 year ago #

    I also tried to insert

    query_posts(array('paged' => 1 ));

    before calling the loop file in index.php, but no posts at all were shown.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags