Community Forums › Forums › Archived Forums › Design Tips and Tricks › Where to place pagination code
Tagged: gallery, pagination code
- This topic has 16 replies, 3 voices, and was last updated 8 years, 8 months ago by Tom.
-
AuthorPosts
-
January 5, 2016 at 12:29 pm #175660designerwriterMember
I want to place this pagination code but not sure where to place it. Does it go on the theme functions page and if so where? Here is the code with the full page theme.functions php afterwards. I am using magazine pro and this is the line of code from BestWebSoft:
if ( function_exists( 'pgntn_display_pagination' ) ) pgntn_display_pagination( 'multipage' );
Themefunctions.php code:
<?php
//* Start the engine
include_once( get_template_directory() . '/lib/init.php' );//* Setup Theme
include_once( get_stylesheet_directory() . '/lib/theme-defaults.php' );//* Set Localization (do not remove)
load_child_theme_textdomain( 'magazine', apply_filters( 'child_theme_textdomain', get_stylesheet_directory() . '/languages', 'magazine' ) );//* Child theme (do not remove)
define( 'CHILD_THEME_NAME', __( 'Magazine Pro Theme', 'magazine' ) );
define( 'CHILD_THEME_URL', 'http://my.studiopress.com/themes/magazine/' );
define( 'CHILD_THEME_VERSION', '3.1' );//* Enqueue Google Fonts and JS script
add_action( 'wp_enqueue_scripts', 'magazine_enqueue_scripts' );
function magazine_enqueue_scripts() {wp_enqueue_script( 'magazine-entry-date', get_bloginfo( 'stylesheet_directory' ) . '/js/entry-date.js', array( 'jquery' ), '1.0.0' );
wp_enqueue_script( 'magazine-responsive-menu', get_bloginfo( 'stylesheet_directory' ) . '/js/responsive-menu.js', array( 'jquery' ), '1.0.0' );
wp_enqueue_style( 'dashicons' );
wp_enqueue_style( 'google-fonts', '//fonts.googleapis.com/css?family=Roboto:300,400|Raleway:400,500,900', array(), CHILD_THEME_VERSION );
}
//* Add HTML5 markup structure
add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' ) );//* Add viewport meta tag for mobile browsers
add_theme_support( 'genesis-responsive-viewport' );//* Add new image sizes
add_image_size( 'home-middle', 360, 200, true );
add_image_size( 'home-top', 750, 420, true );
add_image_size( 'sidebar-thumbnail', 100, 100, true );//* Add support for additional color styles
add_theme_support( 'genesis-style-selector', array(
'magazine-pro-blue' => __( 'Magazine Pro Blue', 'magazine' ),
'magazine-pro-green' => __( 'Magazine Pro Green', 'magazine' ),
'magazine-pro-orange' => __( 'Magazine Pro Orange', 'magazine' ),
) );//* Add support for custom header
add_theme_support( 'custom-header', array(
'default-text-color' => '000000',
'header-selector' => '.site-title a',
'header-text' => false,
'height' => 90,
'width' => 380,
) );//* Reposition the primary navigation menu
remove_action( 'genesis_after_header', 'genesis_do_nav' );
add_action( 'genesis_before_header', 'genesis_do_nav' );//* Add primary-nav class if primary navigation is used
add_filter( 'body_class', 'backcountry_no_nav_class' );
function backcountry_no_nav_class( $classes ) {$menu_locations = get_theme_mod( 'nav_menu_locations' );
if ( ! empty( $menu_locations['primary'] ) ) {
$classes[] = 'primary-nav';
}
return $classes;
}//* Customize search form input box text
add_filter( 'genesis_search_text', 'magazine_search_text' );
function magazine_search_text( $text ) {return esc_attr( __( 'Search the site ...', 'magazine' ) );
}
//* Modify the size of the Gravatar in the author box
add_filter( 'genesis_author_box_gravatar_size', 'magazine_author_box_gravatar' );
function magazine_author_box_gravatar( $size ) {return 140;
}
//* Modify the size of the Gravatar in the entry comments
add_filter( 'genesis_comment_list_args', 'magazine_comments_gravatar' );
function magazine_comments_gravatar( $args ) {$args['avatar_size'] = 100;
return $args;}
//* Remove entry meta in entry footer
add_action( 'genesis_before_entry', 'magazine_remove_entry_meta' );
function magazine_remove_entry_meta() {//* Remove if not single post
if ( ! is_single() ) {
remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_open', 5 );
remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_close', 15 );
}}
//* Remove comment form allowed tags
add_filter( 'comment_form_defaults', 'magazine_remove_comment_form_allowed_tags' );
function magazine_remove_comment_form_allowed_tags( $defaults ) {$defaults['comment_notes_after'] = '';
return $defaults;}
//* Add support for 3-column footer widgets
add_theme_support( 'genesis-footer-widgets', 3 );//* Add support for after entry widget
add_theme_support( 'genesis-after-entry-widget-area' );//* Relocate after entry widget
remove_action( 'genesis_after_entry', 'genesis_after_entry_widget_area' );
add_action( 'genesis_entry_footer', 'genesis_after_entry_widget_area' );//* Register widget areas
http://magazinepro.eagleheartdynamic.com/
genesis_register_sidebar( array(
'id' => 'home-top',
'name' => __( 'Home - Top', 'magazine' ),
'description' => __( 'This is the top section of the homepage.', 'magazine' ),
) );
genesis_register_sidebar( array(
'id' => 'home-middle',
'name' => __( 'Home - Middle', 'magazine' ),
'description' => __( 'This is the middle section of the homepage.', 'magazine' ),
) );
genesis_register_sidebar( array(
'id' => 'home-bottom',
'name' => __( 'Home - Bottom', 'magazine' ),
'description' => __( 'This is the bottom section of the homepage.', 'magazine' ),
) );January 5, 2016 at 1:57 pm #175674TomParticipantThat code looks kinda suspect. Check your tutorial for completeness and instructions. Typically, you would just place the code carefully at the end of the functions.php file.
For pasting code snippets here, please see: https://www.studiopress.community/faq/#code
Another method is to select the code snippet and click the "code" button in the forum post editor to wrap it in 'backticks'.
Choose your next site design from over 350 Genesis themes.
[ Follow me: Twitter ] [ Follow Themes: Twitter ] [ My Favourite Webhost ]January 5, 2016 at 5:04 pm #175689designerwriterMemberYou mean the code that was given to me for the pagination by BestWebSoft? Does genesis have a pagination plugin I can use for the pages? I also have pages for my photography gallery and apparently, a lot of the pagination plugins don’t work for galleries so I have to do it by hand. Thank you for the help.
January 5, 2016 at 6:09 pm #175692TomParticipantYou mean the code that was given to me for the pagination by BestWebSoft?
Yes; can you post a link to their page?'Does genesis have a pagination plugin I can use for the pages?`
Do you have an archive of "pages" (not posts)?How are you creating your galleries page(s)?
Can you post a link to your site?
Choose your next site design from over 350 Genesis themes.
[ Follow me: Twitter ] [ Follow Themes: Twitter ] [ My Favourite Webhost ]January 5, 2016 at 8:40 pm #175704designerwriterMemberYou mean this page for BestWebSoft?
http://support.bestwebsoft.com/hc/en-usHere is the link to my site which is still in development. Once it’s live, it will change to http://eagleheartdynamic.com
magazinepro.eagleheartdynamic.comI am using pages on my site. Yes the galleries are of pages not posts. Here is the first page of the photography section:
http://magazinepro.eagleheartdynamic.com/photography/I did the links at the bottom of the page by hand while I was waiting to figure out which pagination plugin to use.
Thanks Tom!
Grace
January 5, 2016 at 10:45 pm #175706TomParticipantHi Grace,
It's not really clear what you are attempting to do with 'pagination'.
WordPress has blog pagination by default; Genesis includes numeric pagination as an option and your gallery plugin includes several pagination options for gallery pages including a "load-more" prompt and "infinite scroll". Pages are different from posts and aren't grouped in collections, so there is no archive to paginate.
The snippet of code you provided is incomplete. It does refer to the Pagination plugin from BestWebSoft that is available from the WordPress plugin repository but, as written, does nothing.
Can you describe what you are attempting to achieve?
Choose your next site design from over 350 Genesis themes.
[ Follow me: Twitter ] [ Follow Themes: Twitter ] [ My Favourite Webhost ]January 5, 2016 at 11:17 pm #175707designerwriterMemberI want to create pagination that I don’t have to do manually every time I upload a new page. I thought that’s what plugins re pagination were for.
“Genesis includes numeric pagination as an option and your gallery plugin includes several pagination options for gallery pages including a "load-more" prompt and "infinite scroll". Pages are different from posts and aren't grouped in collections, so there is no archive to paginate.”
So are you saying that I can’t put the numbers at the bottom for pages because they are not dynamic like posts are? I prefer pages to posts. The pages that are posts are the dynamic first page because the information is more like an announcement on that page that I have done something new and the blog page is dynamic too.
January 6, 2016 at 12:39 am #175712designerwriterMemberI was also told that the pagination plugins don’t work on galleries.
January 6, 2016 at 5:31 am #175729Victor FontModeratorThe language used in the description of the Pagination plugin by BestWebSoft is unfortunate. The description reads:
The block is added automatically on the following pages: blog, search, archive, category, tags, author
While these are pages, they are all pages that are designed to display blog posts. Both pages and posts are dynamic in WordPress in the sense that they are rendered at run time. They don't exist anywhere on a site except within the database unless you are using a caching plugin. When a user clicks a link, the page or post is generated at that time and served up to the browser.
There is a huge difference in the way WordPress handles pages vs. posts. Pages are used for static content, content that doesn't change frequently. When you click on a link for a page, it is rendered individually. It is not linked to any other pages.
When posts are displayed in one of the page types mentioned above, they are retrieved from the database in a multi-row result set and displayed on the page through the use of a programming loop. By default they are displayed in descending date order with the newest posts at the top of the list. This allows pagination to be accomplished because the results set contains many posts in a fixed order. This is not possible with pages. Pages are served up one at a time. If you want to continue to work with pages for your gallery, you have no choice but to manually add the pagination links to additional pages. There isn't anyway to automate this.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?January 6, 2016 at 11:35 am #175758designerwriterMemberVictor what a great response! You’re the only one who explained this properly to me. I was confused. My graphic design and writing pages won’t be changing except when I add pages. That being said, would you suggest I use posts or pages? It’s no big deal for me to change the code for the pages. I will just change the first set and copy and paste on all of the other pages. The upside to this is that there won’t be any conflicts with plugins when I upgrade.
Here is an example of a graphic design page:
http://magazinepro.eagleheartdynamic.com/freedom-select-wireless-graphic-design/Thank you for your help!
January 14, 2016 at 3:57 pm #176519designerwriterMemberI still have not managed to add proper pagination to my pages. I am using PAGES not posts so the <!--nextpage--> code doesn’t work. I am not splitting posts into pages I want to go from one page to another. I have tried different plugins but they require I use posts not pages. Can someone help me? Otherwise I will just do it manually. At least I won’t have any issues with plugins.
January 14, 2016 at 9:30 pm #176535TomParticipantHeya again,
What you are attempting is not "pagination": you are creating are separate pages of images grouped manually by 'categories': "Landscapes – Alberta and British Columbia" (12 pix), "Wildlife – Alberta" (15 pix) , "Flowers and Plants" (12 pics), "Birds and Butterflies" (14 pix) and "Miscellaneous" (14 pix). This is not what pagination does.
Posts in a blog or archive achieve pagination because they are a body of like content (posts grouped by 'blog' or category or tag) that are split across multiple, linked pages with prev/next links or page numbering, etc., defined by a specific number of items (posts, pics, ... ) per page.
The *first* active gallery plugin
https://wordpress.org/plugins/unite-gallery-lite/screenshots/
-- as used on your pages -- supports categorization but not pagination (that I could find). It does provide a category selector that functions to restrict display to pix in the selected category. See "Enable Category Tabs" in the gallery settings page. This is a good option for your requirement. Their demo page: http://wp.unitegallery.net/tiles-columns/tiles-columns-category-tabs/The *second* active "Gallery" plugin
https://wordpress.org/plugins/photo-gallery/
does pagination in multiple presentations as I described above: it takes a body of related content (e.g. a gallery of manually grouped image thumbnails) and splits it across multiple linked pages with page numbering and next/previous links (or infinite scroll, or using a "load more" prompt). This plugin allows for the creation and use of custom tags (similar to categories) to create groups of like images but does not appear to provide a method to create galleries restricted to a single tag <?>.Another alternative is NextGen Gallery.
Choose your next site design from over 350 Genesis themes.
[ Follow me: Twitter ] [ Follow Themes: Twitter ] [ My Favourite Webhost ]January 14, 2016 at 9:46 pm #176536designerwriterMemberThanks Tom. I was going to use NextGen Gallery but decided to try something new.
I need your opinion on the Graphic Design page....there are 20 pages so I attempted to do it manually but it didn’t look great..too long. So these are separate pages. Should I just use Previous and Next manually or switch to posts? I just didn’t want one long post for the Graphic Design section because it gets more difficult to manage as one long post for 20 pages you know what I mean? I have to change the sidebars in this section...but here is the link. It looks ridiculous with 20 linked numbers. lol
http://magazinepro.eagleheartdynamic.com/canadian-securities-exchange-graphic-design/
January 14, 2016 at 9:48 pm #176537designerwriterMemberBy the way, I am using justified tiles. I might revert to NextGen since I have used it before but it’s been a while. Do they have pagination? Also, the irritating thing about Photo Gallery is that I can’t sort images by drag and drop. That alone, has changed my mine to switch to NextGen Gallery and they are good at keeping their product up to date. Photocrati owns them now and they did a complete revamp of the plugin a few years ago.
January 14, 2016 at 9:57 pm #176539designerwriterMemberTom do you suggest I change everything to posts instead of using separate pages if it gets me the pagination? It’s work to change it but I have spent enough time on this! I guess pages are just not in vogue anymore at least that’s what it seems. I went on some forums and other people were having issues finding a suitable “pagination” plugins for separate pages. If i keep the pages, I guess I will just have to use Previous and Next correct?
January 14, 2016 at 11:28 pm #176547TomParticipant1. "Graphic Design page…." Separate pages are the way to go for these. The string of links you've manually built at the bottom of most pages are unnecessary and redundant - the numbers give no reference to the content. I think you should use the "Graphic Design" gallery page as a starting point, then in the individual pages include a "back to the gallery" type link. It's simple and never needs maintenance. You should note for these links that you've included
target="_blank"
on almost all of them. This forces the link to be opened in a new tab or window. It gets annoying fairly quickly and is generally frowned upon for use on internal links.2. For questions about NextGen Gallery refer to their WordPress plugin page and support website. Yes, they have been acquired by Photocrati, but anyone that
remembersenduredsurvived the upgrade from version 1.9.13 to 2.x and how it nearly killed the plugin (in my opinion). Certainly a great many developers and bloggers were fed up with the failures and extra work required to continue using it, and will think carefully before they use NextGen again. They should be over that now, so see if it works for you.https://en-ca.wordpress.org/plugins/nextgen-gallery/ http://www.nextgen-gallery.com/
3. You really should gain an understanding of pages and posts and how they are different. It's not a matter of popularity or any au courant trend -- they are fundamentally different things with different properties and purposes. They are similar enough to breed confusion and may at times seem interchangeable so gaining some background is important.
Choose your next site design from over 350 Genesis themes.
[ Follow me: Twitter ] [ Follow Themes: Twitter ] [ My Favourite Webhost ]January 15, 2016 at 1:42 pm #176617TomParticipantI tried to post this last night, so at the risk of seeing a double post:
1. "Graphic Design page…." Separate pages are the way to go for these, linked from your gallery. The string of links you've manually built at the bottom of most pages are unnecessary and redundant - the numbers give no reference to the content and every page must be maintained with each new page added. I think you should use the "Graphic Design" gallery page as a starting point, then in the individual pages include a "back to the gallery" type link. It's simple and never needs maintenance. Ther are other methods, but this builds most closely on what you've already constructed. You should note for these links that you've included
target="_blank"
on almost all of them. This forces the link to be opened in a new tab or window. It gets annoying fairly quickly and is generally frowned upon for use on internal links.2. For questions about NextGen Gallery refer to their WordPress plugin page and support website. Yes, they have been acquired by Photocrati, but anyone that
remembersenduredsurvived the upgrade from version 1.9.13 to 2.x and how it nearly (in my opinion) killed the plugin ... certainly a great many developers and bloggers were fed up with the extended string of fixes and extra work required to continue using it, and will think carefully before they use NextGen again. It seems to have been stable for a while now, so see if it works for you.https://en-ca.wordpress.org/plugins/nextgen-gallery/ http://www.nextgen-gallery.com/
3. You really should gain an understanding of pages and posts and how they are different. It's not a matter of popularity or any au courant trend -- they are fundamentally different things with different properties and purposes. They are similar enough to breed confusion and may at times seem interchangeable, so gaining some background is important.
Choose your next site design from over 350 Genesis themes.
[ Follow me: Twitter ] [ Follow Themes: Twitter ] [ My Favourite Webhost ] -
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.