[wp-trac] [WordPress Trac] #29484: "posts_per_page" also restricts the number of images in a gallery
WordPress Trac
noreply at wordpress.org
Wed Sep 3 06:15:46 UTC 2014
#29484: "posts_per_page" also restricts the number of images in a gallery
--------------------------+-----------------------------
Reporter: Avantart | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Gallery | Version: 3.9.2
Severity: normal | Keywords:
Focuses: ui |
--------------------------+-----------------------------
When you define the number of posts on a page, f.e. the homepage,
galleries in the posts also show only this number of images.
I use galleries with defined IDs.
For example: the gallery consists of 12 images, but the ''posts_per_page''
is set to 5 for the homepage in ''functions.php'', so only the first 5
images are shown
''posts_per_page'' should not have any impact on the number of images in a
gallery
Check here:
you see 5 images in gallery
[http://www.wockensolle.de/page/2/]
on single page you see 12 images:
[http://www.wockensolle.de/2014/08/27/der-2-tag-in-riga/]
the setting in the functions.php of my theme:
{{{
function custom_posts_per_page($query){
if(is_home()){
$query->set('posts_per_page',5);
}
if(is_search()){
$query->set('posts_per_page',+5);
}
if(is_archive()){
$query->set('posts_per_page',10);
}
}
add_action('pre_get_posts','custom_posts_per_page');
}}}
the gallery shortcode in the post:
{{{
[gallery link="file" columns="2"
ids="25386,25387,25388,25389,25390,25391,25392,25393,25394,25395,25396,25397"]}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/29484>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list