Support » Plugin: Easy Photography Portfolio » Multiple pages for “All portfolio entries”

  • Resolved falkrist

    (@falkrist)


    Hi guys!
    Thanks for such minimalist and elegant portfolio plugin you’ve made!

    I have short question. If it’s possible to implement multiple pages once option “Show All portfolio entries” is enabled for “In Portfolio Home Page” in plugin settings? I mean to set up it like in BLOG: once you’ve reach maximum count of posts on one page button “OLDER POSTS” appear.

    Thanks in advance!

    Regards.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author justnorris

    (@justnorris)

    Hello there,
    Because it’s meant to be a portfolio plugin – the goal is to have no pagination, because portfolios generally should show only the best work and all of it in one load.

    Can you describe the use case you have in mind for pagination? Why would that be useful?

    Hi Norris!
    Yes, I’m agree with you that portfolio is to show the best of the best of works done.

    But in some cases you need to show all categories at once and it could be a lot of thumbnails to download for one page: e.g. Fashion Photography, Beauty Photography, Nature Photography, Wildlife photography, Black and White, Wedding Photography, HDR Photography,
    Travel Photography, Time Lapse Photography, Macro photography, Hi speed Photography, Panoramic Photography, Motion Photography, etc.

    So I’m wondering if it’s possible to implement pagination for such cases? And maybe implement functionality to show 5-10-15 thumbnails per page.

    Thanks for your reply.

    Regards.

    Plugin Author justnorris

    (@justnorris)

    If you’re able to use WordPress hooks – you can modify the main query and just append pagination to the portfolio. That’s the only way to achieve that right now.

    I’m not sure I fully understand your site structure though. You say “Categories”, but by default – Easy Photography Portfolio has no thumbnails for categories… did you mean entries? If so – maybe you want to use real categories? You can group portfolio entries in categories and then link to categories from the menu.

    Can you provide a link to a real example of where pagination would be necessary? Otherwise, it’s hard for me to imagine the use case.

    Hi,
    Yeah I understand that I’m always able to amend page, but in case of update it will overwritten.

    Here is an example:
    https://yulianaphoto.com.ua/portfolio/category/all/
    so in case if here will be more then 20+ categories it would be helpful to have possibility to make few pages.

    Anyway I’ll understand if it’s too hard to implement it, and will appreciate in case if you an provide more details how I can implement such hook by myself (but I’m not programmer)..

    Regards.

    Plugin Author justnorris

    (@justnorris)

    It sounds to me like you have some development chops. In that case – look into the plugin hooks – that way you can keep the pagination when the plugin updates.

    Browse the source here for more info on hooks – I try to keep the code commented and self-documenting: https://github.com/justnorris/easy-photography-portfolio/tree/master/public

    To add pagination to your archive pages, you can just do this:

    
    add_action( 'phort/archive/loop/end',
    	function () {
    		echo "The Pagination HTML";
    	} );
    

    Or, since 1.4.5 you can do this:

    
    <?php
    phort_attach_template( 'archive/layout',
    	function () {
    
    		echo "The Pagination HTML";
    	}, $priority = 75 );
    

    And to modify the WP_Query you can do this:

    
    add_action( 'pre_get_posts', function( \WP_Query $query ) {
    	if( ! $query->is_main_query() || ! $query->is_post_type_archive( 'phort_post' )) {
    		return;
    	}
    
    	// Do whatever you need with the query
    	$query->set( 'posts_per_page', 10 );
    	
    	
    } , 100);
    
    • This reply was modified 2 years, 6 months ago by justnorris.
    • This reply was modified 2 years, 6 months ago by justnorris.
    • This reply was modified 2 years, 6 months ago by justnorris.

    Hi,
    Tried to add above code-parts in different place but didn’t get success 🙂
    As I understand I need to amend hook.php with code:

    add_action( 'pre_get_posts', function( \WP_Query $query ) {
    	if( ! $query->is_main_query() || ! $query->is_post_type_archive( 'phort_post' )) {
    		return;
    	}
    
    	// Do whatever you need with the query
    	$query->set( 'posts_per_page', 10 );
    	
    	
    } , 100);

    And need to update archive-portfolio.php with:

    <?php
    phort_attach_template( 'archive/layout',
    	function () {
    
    		echo "The Pagination HTML";
    	}, $priority = 75 );

    Please correct me if I’m wrong or please bring me the light which files should be updated?

    Thanks a lot for your time.

    Plugin Author justnorris

    (@justnorris)

    You can add the code in your themes (or child theme) functions.php – put the code somewhere that won’t be updated by an external plugin or theme – so either create your own theme/child theme or a plugin.

    Hi again,
    I’ve tried to add these parts of code, but anyway didn’t get why it’s not working.
    As I’ve mentioned I have only html+CSS skills, so can’t understand how to implement it 🙁

    Anyway thanks for your involvement.

    Regards.

    Plugin Author justnorris

    (@justnorris)

    I haven’t tested that code, so I can’t guarantee that it works. If you want to modify the behavior of the plugin – you have to know at least a few bits of PHP. At this point, all I can do is recommend that you find someone who can help you with the customization you’re looking to achieve. You can link them to this topic to understand the general direction the customization should go.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Multiple pages for “All portfolio entries”’ is closed to new replies.