This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

How do I change the posts per page on a portfolio page?

  • Creator
    Topic
  • #19579
    webmastermfrv
    Participant

    Greetings, I need some help configuring the posts_per_page variable for portfolio pages.

    It defaults to 12 right now: 4 rows, 3 columns.

    Thanks in advance for your help.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Author
    Replies
  • #19591
    Jason Bobich
    Keymaster

    Hello,

    When you say a “portfolio” page, can you tell me exactly what you mean? Are you displaying a “post grid” in some way? Or maybe you’re using our Portfolios plugin? Maybe you can link me to example on your site of where you’re wanting change these row and column numbers, so I can see exactly what you’re doing?

    #19592
    webmastermfrv
    Participant

    Hi Jason, thanks for your help with the background. That video spelled it out very clearly. I’m not sure how I missed that in the docs.

    With regard to the “portfolio” question, my problem arose because I’m upgrading a website that used Alyeska v1.1.1. It used a custom post type named “portfolio”. The website featured about 23 portfolio pages showing RVs for rent.

    I purchased the latest version of Alyeska and installed it, then realized that the new version did not have such a custom post type. I installed the ThemeBlvd portfolio plugin. I still had to edit the MySQL db to change the RVs custom post type to “portfolio_item”. It used to be “portfolio-item”. Then I could see the RV posts again and work with them.

    So here’s an example of a “portfolio” page (a custom post grid) showing all the RVs:

    http://www.midfloridarvrental.com/items/rv-inventory/

    The grid originally showed only 4 rows when I needed 7. I didn’t want to use a module because it makes a second padded frame around the content.

    I actually found the answer to my question in the plugin page. The following code in my child theme’s functions.php was able to change the default rows to 7:

    function my_grid_rows() {
    return 7; // Number of rows per page
    }
    add_filter( ‘themeblvd_default_grid_rows’, ‘my_grid_rows’ );

    This worked like a charm. However, I’d like to mention that while I was looking through the theme and framework for a way to set the number of rows, I found this on line 288 of helpers.php:

    // Rows
    $rows = get_post_meta( $post->ID, ‘rows’, true );
    if ( ! $rows ) {
    $rows = apply_filters( ‘themeblvd_default_grid_columns’, 4 );
    }

    Should the third line not be the following?

    $rows = apply_filters( ‘themeblvd_default_grid_rows’, 4 );

    Thanks again for all your help. This theme rocks!

    #19593
    webmastermfrv
    Participant

    Oh, and one final question. Is there an option to enter script code site wide, like for Google Analytics? Currently I just added it to the footer.php file manually.

    #19596
    Jason Bobich
    Keymaster

    It used a custom post type named “portfolio”. The website featured about 23 portfolio pages showing RVs for rent.

    Just for future reference, if you search on wordpress.org, there are several cool little plugins that allow you to convert custom post type posts in bulk.

    Should the third line not be the following?

    This is a typo, but I think this is actually an old function that’s not used any more directly, which was deprecated in framework v2.3. This has all been transitioned to being at /framework/includes/class-tb-frontend-init.php, starting on line 718. So your two filters for rows and columns should work the way you intend.

    Oh, and one final question. Is there an option to enter script code site wide, like for Google Analytics? Currently I just added it to the footer.php file manually.

    From your child theme’s functions.php, you’d just hook to the standard wp_footer action (a standard action that is required to be in all WordPress themes).

    function my_wp_footer() {
    	?>
    	This will output in the footer...
    	<?php
    }
    add_action('wp_footer', 'my_wp_footer');

    But, if you’re just wanting to output analytics, you can probably use this simple little plugin I have. It just has two options — (1) your google tracking code and (2) where you want it output in the source code of your site.

    https://wordpress.org/plugins/simple-analytics/

    It’s a good idea to avoid editing any main theme files like header.php, footer.php, page.php, etc, from your child theme because these files change often with updates. This is why I put many hooks you can use for these files, and make use of template parts.

    http://dev.themeblvd.com/tutorial/primary-framework-action-hooks/

    http://dev.themeblvd.com/tutorial/editable-content-files/

    #19597
    webmastermfrv
    Participant

    Hi Jason, I actually tried one of those bulk post type converters and for some reason it was not working. It did not see the “portfolio” type from the earlier version. That’s why I punted on plugins and decided to just edit the db (after making a backup, of course).

    Thanks for the tip with the analytics plugin and the action hooks. I am definitely trying to keep my customizations in the child theme.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The forum ‘Alyeska Responsive WordPress Theme’ is closed to new topics and replies.