Home>Support>Row background image not showing when using $post->post_content

Row background image not showing when using $post->post_content

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

I’m showing the content a page on an archive page. Here’s the code:

$page = get_page_by_path($post_type);

if ($page) {
	echo apply_filters('the_content', $page->post_content);
}

This allows me to create pages with the same slug as a custom post type so I can show that page’s content at the top of the archive page. Works just fine, but the background images do not appear to be showing. When looking at the generated html, I can still see the data-style attribute on the row container, so something’s not getting picked up. It’s on a private dev site right now, so I can’t share it, but I’ll try to get it posted on a public server if that’ll help.

Thanks!

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 7 years, 9 months ago Jeff Pedigo

    I solved this by using a wp_query to pull up the desired post, at which point just using the_content() worked to show all the Page Builder formatting. So, the working code is:

    $query = new WP_Query(array('post_type' => 'page', 'name' => $post_type));
    if ( $query->have_posts() ) {
    	while ( $query->have_posts() ) {
    		$query->the_post();
    		the_content();
    	}
    	wp_reset_postdata();
    }
  2. 7 years, 9 months ago Alex S
    Hi, I Work Here

    Hi Jeff,

    I would recommend using the following PHP:

    $post_id = get_the_ID();if ( class_exists( 'SiteOrigin_Panels' ) || get_post_meta( $post_id, 'panels_data', true ) ) {	echo SiteOrigin_Panels::renderer()->render( $post_id );} else {	echo apply_filters( 'the_content', get_post( $post_id )->post_content );}
  3. 7 years, 9 months ago Jeff Pedigo

    Thanks Alex S. Worked like a charm!

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