Skip to:
Content
Pages
Categories
Search
Top
Bottom

Different Replies per Page for Mobile Theme


  • ljmac
    Participant

    @ljmac

    Hi,

    I have the replies per page in bbPress set to 10, which is what I want for my desktop theme. However, I want to reduce this to 5 for my mobile theme. How can I go about doing this?

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

  • ljmac
    Participant

    @ljmac

    So no one can help me with this? I know that the Jetpack mobile theme restricts the blog posts to 5 per page (even though it is set to 10 in the WordPress settings, which is what I want for my desktop theme), so I assume there must be some kind of hook I can use to do the same with bbPress posts.


    Robin W
    Moderator

    @robin-w

    Sorry, there are only a very few of us who volunteer to help here, this is free software with free unpaid support and we give what time we are able.

    It is doable, but I know of nothing that does it, let me do some digging when I get a moment.


    ljmac
    Participant

    @ljmac

    Thank you so much for your help Robin – I appreciate it.


    Robin W
    Moderator

    @robin-w

    so try this code, amending the numbers to what you want

    if (wp_is_mobile()) {
    add_filter ('bbp_get_topics_per_page', 'mobile_topics_per_page') ;
    add_filter ('bbp_get_replies_per_page', 'mobile_replies_per_page') ;
    }
    
    function mobile_topics_per_page () {
    	return '4' ;
    }
    
    function mobile_replies_per_page () {
    	return '3' ;
    }

    Put this in your child theme’s function file –

    ie wp-content/themes/%your-theme-name%/functions.php

    where %your-theme-name% is the name of your theme

    or use

    Code Snippets


    Robin W
    Moderator

    @robin-w

    I would add that the replies but doesn’t work with threaded replies, but I am not a fan of threaded replies !

    If you are using them come back, but from a quick inspection, it looks like the ‘replies per page’ in the dashboard>settings>forums>replies per page doesn’t work for threaded replies in all cases.


    ljmac
    Participant

    @ljmac

    Thank you so much again for your help Robin – this is very helpful information.


    ljmac
    Participant

    @ljmac

    Oh and yes, I don’t use threaded replies either.


    Robin W
    Moderator

    @robin-w

    great – glad to have helped

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