Problems loading So content via WP_Query in footer.php on WooCommerce shop page
Hi,
I’ve had problems loading the SiteOrigin PB content of a post in the footer using WP_Query. I realized that the stylesheet and the scripts from siteorigin-panels haven’t been loaded. This happened only on WooCommerce shop page.
The reason is found in siteorigin-panels.php on line 421-423. There, the post ID is set to the ID of the shop page.
Why? If I uncomment the line, everything works fine!?
Please fix that bug (found in V. 2.10.0).
Thanks,
Kurt
This is our free support forum. Replies can take several days.
Need fast email support? Get SiteOrigin Premium
Replies
5Hi Kurt,
Would it be possible for you to provide me with a copy of your PHP so I can run some tests? This will, hopefully, allow us to identify how to avoid your code from triggering the WooCommerce checks on lines 421 – 423 which are required for WooCommerce so SitEOrigin Page Builder can be used on the shop page.
Sure.
<?php $footerID = 126; $post = get_post($footerID); echo apply_filters('the_content', $post->post_content); ?>Hi Kfidel,
Thanks. You can avoid this by setting up a proper query as that will prevent WooCommerce from returning true for is_shop() as the main query is still attached to the shop page (this will also allow you to use the_content()), or you can render SiteOrigin Page Builder directly. For the latter, here’s some example code you could use:
if ( class_exists( 'SiteOrigin_Panels' ) && get_post_meta( $post_id, 'panels_data', true ) ) { echo SiteOrigin_Panels::renderer()->render( $footerID); } else { echo apply_filters( 'the_content', get_post( $footerID)->post_content ); }Perfect, thanks!
Hi Kfidel,
Awesome, great to hear that helped! :)
Please be sure to post another thread if you have any other questions.
Replies on this thread are closed.
Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.