Responsive WordPress Theme – Caliber

A theme with simple controls and limitless potential. Work fast and build an amazing website!   Find out more »

UpThemes – Beautiful WordPress Themes

Create a site your church, gallery, newspaper, blog, recipes, band and more!   See the themes »

Need a little help?  Find answers quickly by searching the forum.
Group Admins
  • andy
  • jeffw
  • admin

Support for: Moxie – Responsive Theme for WordPress

Moxie

Public Group  |  active 4 years, 3 months ago ago
Viewing post 1 to 15 (28 total posts)

Default portfolio template is broken if you have more than 10 items

  • vunguyen

    said

    Hi Guys,

    The default portfolio templates is broken if you have more than 10 items.
    Default format: 3 columns and filters.
    –> If you have more than 10 , it will start paging at 10 items.
    –> However, if you try to go to page 2 (next page), it will display an 404.

    The portfolio short codes works. However, the filter function isn’t quite right if you use paging.
    Example:
    - I have 25 items
    - I set portfolio shortcode to display 3 columns and 9 items each page.
    - Paging is on.
    - I have a total of 3 items under Audio Portfolio category.

    –> If I use audio filter on page 1, it will show me 1 item only because only 1 Audio item is on page 1.
    If I want to see the other 2, I need to go to page 2 and run the filter again. (and so on)
    Please correct me if I’m wrong but I think the whole point of filtering is so you can see everything under the same category. In this case, the filtering doesn’t seem to work very well with paging.

    Maybe instead of paging, you can give us a settings to lazy load the portfolio post instead of paging.
    That way, when someone use the filter, it can pull up all the portfolios instead of going through each page.
    I’m just talking out of my butt here but I believe that will be more intuitive and make sense to end-user.

    Thanks guys!

  • jeffw

    said

    Hi, vsync.

    Thank you for letting us know what you found, I’ll make sure that @andy sees this.

  • andy

    said

    I’m testing this now and will have more information soon. Thanks.

  • andy

    said

    To fix the paging issue, open the files “templates/portfolio-filtered.php” and “templates/portfolio-static.php” and look for this section in each file:

      // Setup the query 
      $args = array(
        'post_type' => 'portfolio',
        'orderby' => 'menu_order',
        'order' => 'ASC',
        // 'posts_per_page' => -1 // no paging yet?
      );

    It should be around line 20. It needs the $paged variable added to it. The end result will look like this:

      // Setup the query 
      $args = array(
        'post_type' => 'portfolio',
        'orderby' => 'menu_order',
        'order' => 'ASC',
        'paged' => $paged
      );

    It looks like I left myself a note to fix this and missed it during my code review at the end of the theme development. Once that’s done it should do the paging just fine.

    Regarding the filtering of items. The way it is now, filtering the specific items on each page, is the way it is likely going to stay. I think it can be confusing for the filter to pull items not shown on the current page. I don’t have plans to modify this behavior now but I will keep it in mind for future updates.

  • vunguyen

    said

    Hi Guys!

    Thanks a lot, you guys are top.
    Thanks you @andy ! Like I said, it is just a suggestion to make it’s more intuitive.
    I will find the work around for the moment. Hopefully, you will change the filter behaviour in the future so it will actually does what it supposed to do :)

    Thanks again!

  • vunguyen

    said

    Hi @andy,

    That didn’t fix it. Two issues:
    1. If I use Page Attributes and choose Portfolio – Filtered template. It’s still showing the same 404 error if I try to go to page 2 or next page.
    2. The default filtered and static portfolio template of the Page Attributes are set in 3 columns view. However, the paging starts at 10. That means it will looks like this on the page:

    n1  n2  n3
    n4  n5  n6
    n7  n8  n9
    n0
    

    It doesn’t look all that pretty ;)

    2 Notes:
    - Paging function of Portfolio – Static template in Page Attributes works
    - Shortcode still works though.

    Thank you!

  • andy

    said

    Did you make the change in both files?

    1. templates/portfolio-filtered.php
    2. templates/portfolio-static.php

    I just tested it again and the paging fix, when applied to both files, fixed the problem in the filtered and static portfolios. I will address the posts per page issue in a bit after we confirm the paging issue is fixed.

  • vunguyen

    said

    Hi @andy,

    I went over and over again just to make sure but the answer is: yes. I did change exactly like what you told me.
    - The portfolio filtered template using Page Attributes still breaks
    - The static portfolio template using Page Attributes WORKS.
    Here is the code in my portfolio-filtered.php

    <?php global $custom_query, $params, $portfolio;
    /**
     * Template Name: Portfolio - Filtered
     */
     
    // Set the portfolio display type
    $portfolio['type'] = 'filtered';
     
    // Check for the custom query, most likely from shortcode
    $fromShortcode = ($custom_query) ? true : false;
     
    // Load the template 
    if ( $fromShortcode ) {
     
      // For shortcode just include portfolio loop
      get_template_part( 'templates/portfolio' ); 
     
    } else {
     
      // Setup the query 
      $args = array(
        'post_type' => 'portfolio',
        'orderby' => 'menu_order',
        'order' => 'ASC',
        'paged' => $paged
      );
      $custom_query = new WP_Query( $args );
      
      // Include full content structure with header and footers
      get_template_part( 'archive-portfolio' );
     
    } ?>
    

    Thank you.

  • jeffw

    said

    @andy

    I’ve just tested this and it solved the 404 Not Found issue for me.

    @vunguyen

    You set the number of items to display with the Blog pages show at most setting in Settings > Reading. It sounds like you need to set this to “9″. If you are using the [portfolio] shortcode then you can use the posts_per_page attribute to override this default WordPress setting.

  • vunguyen

    said

    Hi jeffw,

    I have no idea why the fix from andy didn’t work for filtered portfolio.
    I set Settings > Reading to 9 like you said. It is now showing 9 posts on the default portfolio template (nice look :D )
    However, when I click next to the next page: still 404. :(
    Here is my Portfolio page settings:
    - Portfolio page: no content
    - Page Attributes: no parent; Portfolio Filtered; Order 7
    - Content Options: Header: Portfolio header; Body: Portfolio; Footer: Default footer
    - Enable Auto Paragraphs: – Select -
    - Hide Title: ticked

    I tried changing the Content Options around but no luck
    I’m baffled. Same fix, works for static template. Didn’t work for filtered template.

    Thanks guys! :(

  • jeffw

    said

    After modifying the portfolio templates I can no longer replicate the issue you are having. I could before, but not after applying Andy’s fix. Have you deactivated all plugins (all at the same time) to make sure none of them is causing an issue?

  • vunguyen

    said

    Hi jeffw,

    I don’t have any plugin running except Visual Composer and Revolution Slider. :(
    Also, I’ve just found out that the portfolio/blog short-code are also sort of broken.
    Example:
    - Blog shortcode: I have 3 post categories with ID: 1, 2, 3
    According to your docs: I created 1 page with this short code: [blog template="blog-image-top" paging="true" category_in="(2,3)"]
    - Portfolio shortcode: I have 6 portfolio categories with ID: 4, 5, 6, 7, 8, 9
    According to your docs: I create 1 page with this short code: [portfolio template="portfolio-static" columns="5" posts_per_page="100" category_in="(5,6)"]

    Both of them didn’t work. They call ALL the categories of their type. Example:
    - Blog shortcode call all 1, 2, 3 categories.
    - Portfolio shortcode call all 4,5,6,7,8,9 portfolio categories.

    Something strange is going on guys :’(

    I will do a fresh install of Wordpress and let you know if andy’s fix working or not.

    Thank you!

  • vunguyen

    said

    Updates:
    1. Default templates:
    - Andy fix did fix the issue for default templates.
    - You will need to completely deleted the existing page and then create a new one. (I don’t know why)

    2. Blog and Portfolio shortcodes:
    - It doesn’t work even on a brand new installation.
    - It will work if you are trying to call ONE (1) category only using example: cat="(5)"
    - If you are trying to call an array, it will call all the categories you have of that post type. (I’m using category_in according to the link in Moxie’s documentation: https://codex.wordpress.org/Class_Reference/WP_Query#Category_Parameters)

    Thanks guys!

  • jeffw

    said

    I’ve just done a bit of testing with the [blog] shortcode and it is not working as expected. I’ve reported it to Andy.

    I’d say this is a totally different issue to the subject under discussion in this topic so if you want to discuss this shortcode issue further please start a new topic for it. Let’s try to limit this topic to discussing the 404 Not Found pagination issue.

  • vunguyen

    said

    Thanks jeffw,

    I will create a new topic about this issue.
    Thank you and andy for fixing the pagination issue.

    Top support!

Viewing post 1 to 15 (28 total posts)
Topic tags: broken, default, more than 10 items, paging, portfolio