All shortcodes not working on custom theme

I’m using a custom theme not developed by myself that seems to have disabled/ or doesn’t have the function for any and all shortcodes, whether its a WordPress shortcode or a plugin shortcode. I mostly need this function to work via a plugin generated shortcodes. I’ve checked several things to see what is causing it but have had no luck finding where the issues is. Here is what I have checked.

When I switched back to the 2012 theme, the shortcodes worked fine.

Read More

I’ve disabled all my other plugins to checked to see if it was due to some incompatibility. No change.

I’ve made sure the page template has the correct loop per this post:
plugin shortcodes not working on custom theme- unsure how to fix

*Edit: Here is the code for the page template

    <?php get_header(); ?>
<div id="main">
<div class="layout">

    <div id="content">
    <aside id="block_menu_like_division">
        <section>
            <h1 id="title_like_division"></h1>
            <nav id="nav_like_division">

            </nav>
        </section>
    </aside>
      <section>
        <article> 
          <?php // while ( have_posts() ) : the_post(); 
            if(get_the_content()){
          ?>

            <?php if(get_the_ID() == 1228) { ?>
                <h1>Forms</h1>
                <?php the_content(); ?>
            <?php }elseif(get_the_ID() == 1191){ ?>
               <!-- <h5>&nbsp</h5> -->
                <?php the_content(); ?>
            <?php }else{ ?>

                <h1><?php the_title(); ?></h1>
        <?php
                    function sup($text){

                        $true = preg_replace('#(d+)(st|th|nd|rd)#', '$1<sup class="super">$2</sup>', $text);
                        return $true;

                    }
                echo sup(get_the_content()); ?>
            <?php } ?>
            <?php }else{
                $arg = query_posts(array('post_parent' => get_the_ID(), 'post_type' => 'page', 'posts_per_page'=>1,  'orderby' => 'menu_order', 'order' => 'ASC' ));

//                    $arg[0]->guid;
                ?>
                <?php if($arg[0]->ID == 1811):?>
                <?php
                $ag = query_posts(array('post_parent' => $arg[0]->ID, 'post_type' => 'page','posts_per_page'=>1,  'orderby' => 'menu_order',  'order' => 'ASC' ));
                ?>
                <h1><?php echo $ag[0]->post_title; ?></h1>
                <?php echo $ag[0]->post_content; ?>
                <?php else:?>
                <h1><?php echo $arg[0]->post_title; ?></h1>
                <?php echo $arg[0]->post_content; ?>
                <?php endif;?>
                <?php }?>
          <?php // endwhile; // end of the loop. ?>
        </article>
      </section>
    </div>
    <aside>
        <?php include('quick_links.php'); ?>



        <?php
        $url = $_SERVER['REQUEST_URI'];
        $url_parse = parse_url($url);
        $level = explode('/', $url_parse['path']);


        if($level[1] == 'education' || $level[1] == 'fellowship'):?>
        <?php
        $catid = get_query_var('cat');
            $s = query_posts( array(
                'post_type' => 'post',
                'post_status' => 'publish',
                'category' => 'news',
                'posts_per_page' => 0, 
                'orderby' => 'post_date',
                'order' => 'DESC'));
        while( have_posts() ) : the_post();
            $newsList[] = array(
                'title' => get_the_title(),
                'link' => apply_filters('the_permalink', get_permalink()),
                'date' => apply_filters('the_time', get_the_time( 'F j, Y' ), 'F j, Y'),
                'expert' => apply_filters('the_excerpt', get_the_excerpt()),
                'author' => get_the_author(),
                );
        endwhile;
        wp_reset_query();


        ?>
        <section>
            <h2>News & Information</h2>
                <div id="asideNews" class="itemsList">
            <div class="listItem">
                <article>
                    <header>
                        <h3><a href="<?php echo $newsList[0]['link']; ?>"><?php echo $newsList[0]['title']; ?></a></h3>
                    </header>
                    <p><?php echo $newsList[0]['expert']; ?></p>
                    <div class="readmore"><a href="<?php echo $newsList[0]['link']; ?>">Read More</a></div>
                </article>
            </div>
        </div>


            </section>

        <?php else:?>
        <?php

            include('testimonials.php');

            ?>
      <?php endif;?>

    </aside>
</div>

</div>
<?php get_footer(); ?>

There is a possibility the original developer simply reused a theme developed for an older version of WordPress when shortcodes didn’t exist.

Any ideas where to look next?

Related posts

Leave a Reply

2 comments

  1. So I finally found a solution!!! After many weeks of searching and trying different solutions, it was just a matter of removing “get_” from a reference of “the_content” in my page.php I changed this

    <?php
                        function sup($text){
    
                            $true = preg_replace('#(d+)(st|th|nd|rd)#', '$1<sup class="super">$2</sup>', $text);
                            return $true;
    
                        }
                    echo sup(get_the_content()); ?>
    

    To this

    <?php
                        function sup($text){
    
                            $true = preg_replace('#(d+)(st|th|nd|rd)#', '$1<sup class="super">$2</sup>', $text);
                            return $true;
    
                        }
                    echo sup(the_content()); ?>
    

    So far I have had no issues, and all the shortcodes are now working.
    Thanks to all the others for their input, without it I wouldn’t have known where and what to look for.

  2. Your Loop is correct. It uses ‘the_content’ (as it should) which should trigger the the_content filters and your shortcodes should process just like in the other themes you tried.

    I have to conclude that your theme is removing filters or shortcodes. Look for a something like remove_filter( 'the_content', in your theme files. Check for add_filter('the_content', as well. Then look for remove_shortcode and see what it might be removing.

    Maybe the theme is adding a filter that breaks the shortcodes, but I’d bet on the one of the first two.