Skip to:
Content
Pages
Categories
Search
Top
Bottom

Remove top pagination but keep bottom


  • demonboy
    Participant

    @demonboy

    Mildly baffled by this. I’m trying to remove the pagination at the top of the forum topic page but leave it at the bottom (see here for an example). I can remove both by commenting out the code in pagination-topics.php, or I can remove both with display:none, but how do I remove the top one and not the bottom one? They share exactly the same properties.

    Thanks,

    Jamie

Viewing 9 replies - 1 through 9 (of 9 total)

  • Suntura
    Participant

    @suntura

    Any idea on how to do this?? I’m trying to do the same.


    Robkk
    Moderator

    @robkk

    @suntura

    you have to wrap the loop with pagination code and divs manually

    like for example in content-single-forum.php, around the loop originally has the get template pagination kind of code, you have to replace the first one above the loop with the php code for the count, and the below with the pagination links.

    like this.

    <div class="bbp-pagination-count">
    
    		<?php bbp_forum_pagination_count(); ?>
    
    	</div>
    
    			<?php bbp_get_template_part( 'loop',       'topics'    ); ?>
    
    <div class="bbp-pagination-links">
    
    		<?php bbp_forum_pagination_links(); ?>
    
    	</div>  

    you have to make sure you are choosing the right pagination set up for each content single file template.

    also make sure you have copied the templates over to your child theme so you can edit them with no problem.


    Shinbat
    Participant

    @shinbat

    Simply, all you need to do is commenting a line in ‘content-archive-topic.php’ as shown below:
    The file path is ‘..\wp-content\plugins\bbpress\templates\default\bbpress\content-archive-topic.php’ at around line number 30.

    <?php bbp_get_template_part( ‘pagination’, ‘topics’); ?>
    <?php bbp_get_template_part( ‘loop’, ‘topics’); ?>
    <?php bbp_get_template_part( ‘pagination’, ‘topics’); ?>

    Just comment the first line to avoid displaying top pagination link as:

    <!—- ?php bbp_get_template_part( ‘pagination’, ‘topics’); ? —–>
    <?php bbp_get_template_part( ‘loop’, ‘topics’); ?>
    <?php bbp_get_template_part( ‘pagination’, ‘topics’); ?>


    o.m.j
    Participant

    @omj-1

    can someone pls post the code to achieve this using a filter in child theme functions.php

    or maybe a style edit?

    *EDIT* disregard…I used this to remove both

    .bbp-pagination-count {
    display: none;
    }


    Pascal Casier
    Moderator

    @casiepa

    Hi o.m.j,

    CSS will not help you in this case, not even nth-child or things like

    #bbpress-forums .bbp-pagination-count {
    	display: none;
    }
    #bbpress-forums .bbp-pagination-count ~ .bbp-pagination-count {
    	display: block;
    }

    will not work because the pagination is inside different divs and other elements.

    The only possibility would be somewhere going for a javascript like

    window.onload = function(){
        document.getElementsByClassName('bbp-pagination-count')[0].style.display = 'none';
    }

    (not tested yet) or go for some coding.

    Pascal.


    o.m.j
    Participant

    @omj-1

    unless I’m missing something…I added the below code to my child theme style.css & now pagination top & bottom is gone…

    .bbp-pagination-count {
    display: none;
    }


    Pascal Casier
    Moderator

    @casiepa

    Indeed, that is what you said and I repeated.
    It will remove EVERY occurrence of the pagination count.


    o.m.j
    Participant

    @omj-1

    yes, I realize this as I originally stated…I don’t want any pagination shown.


    alwaysalready
    Participant

    @alwaysalready

    Just in case anyone is looking to do this, I found a way to remove the pagination altogether (although not top and bottom independently).

    Add the following to the functions.php file in your active theme folder:

    add_filter( 'bbp_get_forum_pagination_count', '__return_false' );

Viewing 9 replies - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.
Skip to toolbar