Tagged: x
-
AuthorPosts
-
July 22, 2016 at 9:00 pm #1099449
Kode3WebParticipantIf you use the portfolio CPT that is included in X but use a different template for the /portfolio page for some extra customization, the first two functions in framework/functions/global/portfolio.php will throw a notice.
The notice is because you find the portfolio page by using the get_pages() WordPress function to find the page that has the template-layout-portfolio.php template set in the postmeta. Since there isn’t a page with that template set and those functions use the result of this get_pages() function call, the result is a notice saying that you can’t get the value of an object that doesn’t exist.
I think the long term fix would be to allow the user to select the page from a combobox instead of trying to make an educated guess.
Here’s my short term fix that I made in framework/functions/global/portfolio.php:
// Get the Page Link to First Portfolio Page // ============================================================================= function x_get_first_portfolio_page_link() { $results = get_pages( array( 'meta_key' => '_wp_page_template', 'meta_value' => 'template-layout-portfolio.php', 'sort_order' => 'ASC', 'sort_column' => 'ID' ) ); return ! empty( $results[0]->ID ) ? get_page_link( $results[0]->ID ) : false; } // Get the Page Title to First Portfolio Page // ============================================================================= function x_get_first_portfolio_page_title() { $results = get_pages( array( 'meta_key' => '_wp_page_template', 'meta_value' => 'template-layout-portfolio.php', 'sort_order' => 'ASC', 'sort_column' => 'ID' ) ); return ! empty( $results[0]->post_title ) ? get_page_link( $results[0]->post_title ) : false; }This allows me to override the x_breadcrumbs() function to specify the correct information. My long term suggestion would work better. You could even use some of the existing code to “guess” the right page if it does use the template and store that page ID. This would allow more fine control.
July 23, 2016 at 1:12 am #1099601
Rue NelModeratorHello There,
Thanks for writing in! We certainly appreciate the feedback! This is something we can add to our list of feature requests. This way it can be taken into consideration for future development. All of these items are discussed with our team internally and prioritized based on the amount of interest a particular feature might receive.
Thanks!
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1099449 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
