Custom post type with dedicated single-solution.php post template

I have a Custom post type that I have created using mainly ACFPro fields.

All these custom fields are populated for each iteration of the post type.

I have a single-solutions.php file in my child theme that creates a full width post with nothing but the post in between the header and the footer.

        <?php
    /*
    Template Name: Solution Info
    Template Post Type: solutions
    */
    ?>

    <?php get_header(); ?>

    <div class="x-main full" role="main">
    	<?php while ( have_posts() ) : the_post(); ?>

        	<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
            	<div class="entry-wrap">

            		<div class="x-container max width">
    					<?php the_content(); ?>
    					<?php if ( is_singular() ) : ?>

    						<div class="entry-extra">
    							<?php x_portfolio_item_tags(); ?>
    							<?php x_portfolio_item_project_link(); ?>
    							<?php x_portfolio_item_social(); ?>
            				</div>

    					<?php endif; ?>
            		</div>
            	</div>
        	</article>

        <?php endwhile; ?>
    </div>

    <?php get_footer(); ?>

The Global block shortcode is

[cs_gb id=2394]

I would like to include the shortcode to a defined global block (topmost section) on this post template automatically by calling it automatically in the top of this page and then allowing additional content defined on a per post basis below the global block by either using either the standard wordpress post content or additional section of probuilder content…

Is this possible?

Hello There,

Yes, that is possible. To output a global block to a template, you need to use do_shortcode. Here’s a sample to be placed inside your template.

echo do_shortcode( '[cs_gb id=2394]' );

Then feel free display other information as needed.
See the following guide for custom fields:


https://xthemetips.com/global-blocks-acf-pro-cpt-template/672/

Hope this helps.

Hi, thank you, that is the article I used to make it all work well… I was just trying to work out if I can declare the pro contents within the template used and thereby hide the ‘content’ block when the ACF field group gets used on the post thereby simplifying the post creation screen for the post author…

Hey @ashley,

That is technically possible however, that would require a fair amount of custom development which is not covered in our product support. But, our Pinnacle team handles custom development projects. If you would like more information, please contact us from here.

Thanks.

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