Pull through content dynamically

Is there a way of pulling content from a post through dynamically using the {{dc:post: }} method?

Hi @RubberDuckers,

Thank you for reaching out to us. You can pull the content of a post via Post Excerpt e.g {{dc:post:excerpt post="713"}} where 713 is the post ID. To find out post IDs please see https://theme.co/apex/forum/t/setup-how-to-locate-post-ids/59

Alternatively you can use Post Meta (Custom Field) option to pull the content of a specific post:

Hope this helps!

Hi,

Thanks but would this pull through the content itself not just an excerpt? I’ve made a template with Global Blocks to dynamically pull through post information.
I have title and featured image but need the content itself too.
I’ve currently done it through the PHP template but it’d be good to use the dynamic content

Hi @RubberDuckers,

Since you already using a custom template, please use the the_content() function instead. There would be possible issues if you use dynamic content for full post content.

Thanks,

Thanks, that’s what I’ve got :slight_smile:

For info, see below. The global blocks are for the header that uses dynamic content and a CTA block.
As you can see: http://jfm-gbs-co-uk.stackstaging.com/make-time-for-your-own-personal-development/

<?php

// =============================================================================
// TEMPLATE NAME: Blank - No Container for Posts
// TEMPLATE POST TYPE: post
// -----------------------------------------------------------------------------
// A post template with no featured image, blank and no container.
// =============================================================================

get_header();

?>

  <div class="x-main full" role="main">
    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
      <div class="entry-content">

        <?php while ( have_posts() ) : the_post(); ?>
		  <?php echo do_shortcode("[cs_gb id=430]"); ?>
		  <div class="x-section">
			  <div class="x-row x-container max width">
				  <div class="x-row-inner">
					  <div class="x-col">
						  <div class="x-text textArea">
							   <?php the_content(); ?>
						  </div>
					  </div>
				  </div>
			  </div>
		  </div>
		  <?php echo do_shortcode("[cs_gb id=206]"); ?>

          <?php x_link_pages(); ?>
        <?php endwhile; ?>

      </div>
    </article>
  </div>

<?php get_footer(); ?>

I guess the layout builder later in the year will enable an easier way of pulling through the content itself?

Hey @RubberDuckers,

The planned Layout Builder will definitely pull content easier as that is it’s main function. For now, you can try following this tutorial:

Hope that helps.

2 Likes

Ah thanks, that’s really cool adding the content as a shortcode instead.

I’ll leave this coded in for now as it works but will update it when the Layout Builder is out!
Thanks

Hey @RubberDuckers,

You may check our changelog for future updates:

https://theme.co/changelog/

Cheers!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.