WordPress.org

Ready to get started?Download WordPress

Forums

increasing the number of pages shown by default? (7 posts)

  1. barnsley242
    Member
    Posted 2 years ago #

    my site shows a maximum of only 5 pages by default and if I create any more than this and it displays a 'more' option.
    (even though there looks to be plenty of room.

    here's the website:
    http://www.alysinkyfingers.co.uk/

    I am using a theme called: 'my-lovely'

    there is a functions.php file (copy of which is here in .txt format: http://www.alysinkyfingers.co.uk/functions.txt)

    this page mentions a maximum menu limit like this:

    function mythemes_menu(){
    
    		if(my_menu_limit()){
    			$limit = my_menu_limit();
    		}else{
    			$limit = _LIMIT_;
    		}
    
    		$my_nav_menu = new mythemes_walker_nav_menu($limit);
    
    		$args = array(
    			'menu'            => '',
    			'container'       => 'div',
    			'container_class' => 'container',
    			'container_id'    => '',
    			'menu_class'      => 'container',
    			'menu_id'         => '',
    			'echo'            => false,
    			'fallback_cb'     => '',
    			'before'          => '',
    			'after'           => '',
    			'link_before'     => '',
    			'link_after'      => '',
    			'depth'           => 0,
    			'walker'          => $my_nav_menu,
    			'theme_location'  => 'menu_in_header',
    		); //menu_in_header

    and there's also a div.menu in css - but not sure if this has anything to do with it?

    any ideas?

    thanks in advance.

  2. vtxyzzy
    Member
    Posted 2 years ago #

    It looks like there is an option in Admin->Appearance->My Theme Options->menu to set the number of items, but it is not saving the value.

    If you edit the functions.php, you can change this line:

    define('_LIMIT_',4);

    and set the number to whatever you like.

    Just be aware that any update to the theme will overwrite this change. To prevent this, you should use a Child theme.

  3. barnsley242
    Member
    Posted 2 years ago #

    thanks,
    I amended the above and also this bit

    define('_LIMIT_',7);	
    
    		var $limit = 7;

    but it didn't work.

    also, nothing seems to happen when I click on save.
    and even reverting back to '4' in the menu appearance settings in admin - fails to be saved (it seems to be stuck on '5' pages).

    may install on another site and experiment with the default install.

  4. barnsley242
    Member
    Posted 2 years ago #

    just done a test on a new site -
    installed a new unaltered and untouched theme (my-lovely theme) and tried amending the default '4' pages to another number - it's not possible to amend this either.

    Yet, I did manage to amend the '4' to a '5' on my first site!

    It can't even be amended to a lower page number.

    The width is not a problem/issue either as I have changed page names to something very long (link below) and there is plenty of room allowed in the css for this to happen:

    http://www.camper.projectuntitled.co.uk/

  5. vtxyzzy
    Member
    Posted 2 years ago #

    OK - a real hack that will disappear if you update the theme:

    In the main theme functions.php, change this:

    function my_menu_limit() {
    	return get_option('myfi_limit');
    }

    to this:

    function my_menu_limit() {
    	//return get_option('myfi_limit');
    	return 7;
    }
  6. shastaw
    Member
    Posted 2 years ago #

    Two more places to look:

    - in the WordPress Appearance->Menus area, make sure there isn't a different menu actually being displayed. i.e. that function does something else menu related, or is deprecated, and isn't actually controlling that area.

    - the code that generates that part of the page: check that someone didn't hard code a value in there. If you can read the PHP this is the way to be certain what it's doing. You might post that part of code if it's unexpected looking.

  7. barnsley242
    Member
    Posted 2 years ago #

    thanks for the posts.
    Editing this bit:

    function my_menu_limit() {
    	//return get_option('myfi_limit');
    	return 7;
    }

    did actually fix the issue on the test site.

    On my original site, yes Shastaw, it looks like this is not being used - as i'm using a custom menu (just can't see where to edit it though) - there are no settings in the admin area to modify the number of pages displayed on a custom menu.

Topic Closed

This topic has been closed to new replies.

About this Topic