how to formatexecute post content and shortcode?

admin2025-06-04  1

<div id="primary" class="content-area">


        <?php 
            if ( have_posts() ) : while ( have_posts() ) : the_post();

                get_template_part( 'content', 'page' );

            endwhile; endif; 
        ?>      


    </div>

As I understand, the above code will execute both content and shortcode. But I want to format first the page content before displaying it in the page. What's the best way to do this? Tia.

UPDATE:

Should have included the content page:

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    <header class="entry-header">
        <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
    </header><!-- .entry-header -->
    <div class="entry-content">
        <?php
            the_content();
        ?>
    </div><!-- .entry-content -->
</article><!-- #post-## -->

If I understand correctly, the_content renders both page text / contents including the shortcode. What I'm trying to do is render the text / page contents separately. I wanted to add styling to text / page contents and shortcode separately.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748989579a315425.html

最新回复(0)