1

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

1 Answer 1

2

You can try to sneak around the problem with a little if statement.

Like this:

<?php

// If it's not the homepage, do the pagination
if(!is_home()){
    echo gmr_get_pagination();
}
?>

Hope this does the job.

3
  • wordpress theme editor cannot save edited file ..syntax error, unexpected ':'
    – Yudi Anto
    Nov 20, 2020 at 16:46
  • That's an entirely unrelated item though... ...the answer should work if you can edit your theme files. Can you FTP? Nov 20, 2020 at 18:25
  • i mean if i copied the code ,wordpress editor mark the end result index php has syntax error..should i edit it via ftp? yes i have access
    – Yudi Anto
    Nov 22, 2020 at 6:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.