Is it possible to display portfolio as a part of main page? I'd like it to be between two blocks of text. Is there any short code or similar so that I could embed the portfolio into the desired place?
Unfortunately not. The theme uses page templates for displaying portfolio items so there is no shortcode to use in a page. You would have to create a child theme to override the template file and customize it from there.
The theme uses "wp_reset_post_data()" to reset the main query loop after using custom WP_Query() (reference: https://codex.wordpress.org/Function_Reference/wp_reset_postdata ). And those two lines of "$wp_query" is for fixing pagination when using custom WP_Query().
The code does have its purpose by the default build. Anyway, you can customize it as per your customization requirements. Thanks for the information!
Hi,
Is it possible to display portfolio as a part of main page? I'd like it to be between two blocks of text. Is there any short code or similar so that I could embed the portfolio into the desired place?
Thanks,
Hi there!
Unfortunately not. The theme uses page templates for displaying portfolio items so there is no shortcode to use in a page. You would have to create a child theme to override the template file and customize it from there.
The portfolio-related template files are:
Regards,
Paul
I was able to implement the shortcode this way:
function portfolio_shortcode( $attr ) {
ob_start();
get_template_part( 'template-parts/portfolio-listing' );
return '</div></div>' . ob_get_clean() . '<div class="post-content-container clearfix"><div class="post-content">';
}
add_shortcode( 'portfolio', 'portfolio_shortcode' );
It works but comment section appears if the shortcode is used. There is a problem in template-parts/portfolio-listing.php.
wp_reset_post_data() should be wp_reset_query().
It does what you tried to accomplish using this block, but in a correct way.
$wp_query = NULL;
$wp_query = $temp_query;
I fixed the problem locally but you may want to include the fix in future releases.
The theme uses "wp_reset_post_data()" to reset the main query loop after using custom WP_Query() (reference: https://codex.wordpress.org/Function_Reference/wp_reset_postdata ). And those two lines of "$wp_query" is for fixing pagination when using custom WP_Query().
The code does have its purpose by the default build. Anyway, you can customize it as per your customization requirements. Thanks for the information!