Home>Support>Problems loading So content via WP_Query in footer.php on WooCommerce shop page

Problems loading So content via WP_Query in footer.php on WooCommerce shop page

Notice: This thread is over two years old; the information may be outdated. Please consider creating a new thread if you require free support. If you have an active SiteOrigin Premium license, you can email our premium support desk at [email protected].

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. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 6 years, 5 months ago Alex S
    Hi, I Work Here

    Hi 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.

  2. 6 years, 5 months ago kfidel

    Sure.

    <?php
    $footerID = 126;
    $post = get_post($footerID); 
    echo apply_filters('the_content', $post->post_content);
    ?>
  3. 6 years, 5 months ago Alex S
    Hi, I Work Here

    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 );
    }
    
  4. 6 years, 5 months ago kfidel

    Perfect, thanks!

  5. 6 years, 5 months ago Alex S
    Hi, I Work Here

    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.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More