admin管理员组文章数量:1315327
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
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
Share Improve this question asked Nov 20, 2020 at 16:11 Yudi AntoYudi Anto 233 bronze badges1 Answer
Reset to default 2You 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.
本文标签: homepageremove paginations functions only on home
版权声明:本文标题:homepage - remove paginations functions only on home 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741976308a2408144.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论