Site icon Hip-Hop Website Design and Development

Custom Theme, Custom shortcode not working

ENV: WordPress version 5.1 / MAMP Pro php v. 7.2.14

I’m building a new, custom theme for a site that has an old, custom theme. The new site is just a single theme, while the old site has a parent theme and a chid theme.

When I change the active theme to my new one, the shortcode that lives in the content area of a Page only renders the text of the shortcode.

When I activate the old child theme it renders perfectly.

Is there something I’m not doing in my new custom theme that is not enabling these shortcodes?

When I enable debugging, I can’t get past the if() statement to get to line 196 of shortcodes.php

if ( empty( $tagnames ) ) {
    return $content;
}

// line 196 --v
$content = do_shortcodes_in_html_tags( $content, $ignore_html, $tagnames ); 

It’s like my shortcode isn’t gettting registered properly.

shortcode code in functions.php

function first_shortcode() {
    $content = '<h1>This is my first shortcode</h1>';
    return $content;
}
add_shortcode('my_shortcode', 'first_shortcode');

UPDATE

Adding template code snippets:

page.php

/**
 *Template Name: Page
 *
 */

global $pageType;
$pageType = "tier"; // this is used as a body tag class

get_header();

get_template_part( 'template-parts/navigation');

?>
<main id="main" class="main-container">
    <?php
        while ( have_posts() ) :
            the_post();

            get_template_part( 'template-parts/content', 'page' );

        endwhile; // End of the loop.
    ?>
</main>

<?php

get_footer();

content-page.php

<?php
/**
 * Template part for displaying page content in page.php
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 * @package hdms
 */
?>

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

    <div class="container fat-margin">
        <div class="entry-content">
            <?php
            the_content();
            ?>
            <?php echo do_shortcode("[my_shortcode]"); ?>
            <p><strong>the above lives in php calling:</strong></p>
            <pre>
                &lt;?php echo do_shortcode("[my_shortcode]"); ?&gt;
            </pre>

        </div><!-- .entry-content -->
    </div><!-- .container -->
</article><!-- #post-<?php the_ID(); ?> -->


Admin (editing) Page Content:


Rendered using my new theme


Rendered using old theme: