This thread is over two years old and may be outdated. Please create a new thread if you need help, or email us if you have an active Premium license.

Get the content inside the_content?

7 years ago · Last reply by Alex S 7 years ago

Hi,

The theme I am using uses page builder.

Is there a way to get to the content without using the the_content() function? I have tried using content_post->post_content, but the content is empty as it is outside of the wp editor. I have tried removing the filter, remove_filter( ‘the_content’, ‘siteorigin_panels_filter_content’ ); but this just leaves me with an empty the_content().

Could someone possibly guide me to getting to the content inside the page builder so I can manipulate it please…?

Many thanks,

This is our free support forum. Replies can take several days.

Need fast email support? Get SiteOrigin Premium

Replies

3
  1. Alex S Staff 7 years, 8 months ago

    Hi Gcooke,

    You can use the following PHP to display the post content without using the_content() and have Page Builder display correctly (if it’s enabled for that page).

    <?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 );
    }
  2. gcooke 7 years, 8 months ago

    Hi,

    Thanks for replying.

    I think this displays page builder content if it is exists or alternatively displays the content.

    I need to get to the content inside page builder. Basically, I want to manipulate the data inside the page builder as I have an issue with page excerpts and need to create a custom excerpt from the data inside the page builder?

  3. Alex S Staff 7 years, 8 months ago

    Hi Gcooke,

    That’s correct – that’s exactly what it does.

    Regarding your question, there’s no easy way to do that. Hm, actually your only real option in that situation is to use:

    SiteOrigin_Panels::renderer()->render( $post_id )

    Generate the excerpt from that (just don’t output it).

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.

Have a different question or issue?

Start New Thread