• Hi, I am trying to use index.php file for both blogs and frontpage.but whenever i use is_front_page_function i get error of
    Deprecated: Function the_block_template_skip_link is deprecated since version 6.4.0! Use wp_enqueue_block_template_skip_link() instead. in?/opt/lampp/htdocs/wp-includes/functions.php?on line?6078
    is it wrong to use is_front_page() in index.php ?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Try like this.

    <?php
    
    // Check if it's the front page
    if ( is_front_page() ) {
        // Content specific to the front page
        echo '<h1>Welcome to My Website!</h1>';
    } else {
        // Content specific to blog posts (assuming posts are displayed on index.php)
        // Use the WordPress loop to display posts
        if ( have_posts() ) {
            while ( have_posts() ) {
                the_post();
                // Display post content here (title, excerpt, etc.)
            }
        } else {
            // Handle the case where there are no posts
            echo '<p>No posts found.</p>';
        }
    }
    
    ?>
    
    Moderator bcworkz

    (@bcworkz)

    That deprecated notice is not directly the result of using is_front_page(), rather it’s some sort of knock on effect. The fact the notice occurred in functions.php is not useful information. You’d need a debug backtrace to learn the true root source of the deprecated notice. It’s likely due to theme or plugin code that was executed as a result of your use of is_front_page(), but your use itself is not in error.

    Thread Starter Kazi Mohammad Foysal

    (@kmfoysal06)

    Thanks, @yaqub16 and @bcworkz , for your assistance with this issue. I’ve decided to create a separate file instead of continuing with the changes in index.php

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WordPress Theme is_front_page() function error’ is closed to new replies.