• Resolved christian_gnoth

    (@christian_gnoth)


    hello,

    I am using on my index.php the following code:


    var_dump(is_front_page());

    if ( is_front_page() )
    {
    // check for referer and show two latest posts excerpts
    //biq_check_referer();
    query_posts(array( 'posts_per_page' => '2', 'category_name' => 'Blog Post' ));

    echo ' <div id="latest_post_container">' . "\n";
    echo ' <div id="latest_post">' . "\n";

    if ( have_posts() )
    {
    while(have_posts())
    {
    the_post();
    $biq_id = get_the_ID();
    echo ' <div ';
    post_class();
    echo ' id="co-post-' . get_the_ID() . '">' . "\n";
    $result = is_front_page();
    var_dump($result);
    echo 'index.php:' . is_front_page() . ':
    ' . "\n";
    echo ' <h3>' . the_title( '', '', false) . '</h3>' . "\n";
    // echo ' <h3>' . the_title( '', '', false) . '</h3>' . "\n";
    // echo ' <h3>' . the_title( '', '', false) . '</h3>' . "\n";
    // echo ' <h3>' . the_title( '', '', false) . '</h3>' . "\n";
    the_excerpt();
    echo ' </div>' . "\n";
    }
    }
    wp_reset_query();

    echo ' </div>' . "\n";
    echo ' </div>' . "\n";
    }

    the is_front_page() function returns true outside the loop, but inside it is returning false.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘is_front_page() returns true outside the loop – inside the loop it returns false’ is closed to new replies.