remove paginations functions only on home

Question

this is my full code for index.php

<?php
/**
 * The main template file.
/* Exit if accessed directly */
if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

get_header();

/* Blog layout options via customizer */
$blog_layout = get_theme_mod( 'gmr_blog_layout', 'gmr-smallthumb' );

?>

<div id="primary" class="col-md-main">
    <div class="content-area">
        <?php
        $modulehome = get_theme_mod( 'gmr_active-module-home', 0 );
        if ( 0 === $modulehome ) {
            do_action( 'bloggingpro_display_modulehome' );
        }
        ?>
        <?php do_action( 'bloggingpro_banner_after_modulehome' ); ?>

        <?php
        $carousel = get_theme_mod( 'gmr_active-headline', 0 );
        if ( 0 === $carousel ) {
                do_action( 'bloggingpro_display_carousel' );
        }
        ?>
        <main id="main" class="site-main gmr-infinite-selector" role="main">
        <?php
        if ( have_posts() ) :
            $count = 0;

            if ( is_home() && ! is_front_page() ) :
                ?>
                <header>
                    <h1 class="page-title screen-reader-text" <?php echo bloggingpro_itemprop_schema( 'headline' ); /* phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped */ ?>><?php single_post_title(); ?></h1>
                </header>
                <?php
            endif;

            if ( is_front_page() && is_home() ) :
                ?>
                <header>
                    <h1 class="page-title screen-reader-text"><?php bloginfo( 'name' ); ?></h1>
                </header>
                <?php
            endif;

            echo '<div id="gmr-main-load">';

            /* Start the Loop */
            while ( have_posts() ) :
                the_post();
                $count++;
                $current_page = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;

                /*
                 * Include the Post-Format-specific template for the content.
                 * If you want to override this in a child theme, then include a file
                 * called content-___.php (where ___ is the Post Format name) and that will be used instead.
                 */
                get_template_part( 'template-parts/content', get_post_format() );

                do_action( 'bloggingpro_banner_between_posts' );

                if ( 6 === $count && 1 === $current_page ) {
                    /* Home module */
                    if ( is_active_sidebar( 'module-after-1' ) ) {
                        echo '<div class="gmr-box-content item-infinite home-module">';
                        dynamic_sidebar( 'module-after-1' );
                        echo '</div>';
                    }
                }

                if ( 9 === $count && 1 === $current_page ) {
                    /* Home module 2 */
                    if ( is_active_sidebar( 'module-after-2' ) ) {
                        echo '<div class="gmr-box-content item-infinite home-module">';
                        dynamic_sidebar( 'module-after-2' );
                        echo '</div>';
                    }
                }

            endwhile;
            echo '</div>';

            echo gmr_get_pagination(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped

        else :

            get_template_part( 'template-parts/content', 'none' );

        endif;
        ?>

        </main><!-- #main -->
    </div><!-- .content-area -->
</div><!-- #primary -->

<?php
get_sidebar();

get_footer();

Im trying to remove paginations only on my homepage but allow it on other pages Eg. archive,category

if i delete this line

echo gmr_get_pagination();

archive and other pages who used paginations are broken

anyone can help me?

thanks

0
Yudi Anto 2 months 0 Answers 8 views 0

Leave an answer