add_filter the_content in functions.php not working

Question

I want to add_filter for the_content in functions.php of my theme.
I have added code which just display echo but it seams that my filter is not applied.

function add_mod_hatom_data($content) {
   // $t = get_the_modified_time('F jS, Y');
   //$author = get_the_author();
   // $title = get_the_title();
   //if(is_single()) {
    echo 'perrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr';
   //   $content .= '<div class="hatom-extra"><span class="entry-title">'.$title.'</span> was last modified: <span class="updated"> '.

//$t.'</span> by <span class="author vcard"><span class="fn">'.$author.'</span></span></div>';
   // }
    return $content;
    }

 add_filter('the_content', 'add_mod_hatom_data');

I have tried to call it like this :

add_filter('the_content', 'add_mod_hatom_data', 99);

or change position to be on top of functions.php with no success.

Do I need to enable somewhere add_filter or it is overridden by some other function ?
NOTE: In my single post template I have :

<?php get_header(); ?>      
            <div id="content" class="clearfix row">
                <div id="main" class="col-sm-8 clearfix" role="main">
                    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

                    <article id="post-<?php the_ID(); ?>" <?php post_class('clearfix'); ?> role="article" itemscope itemtype="http://schema.org/BlogPosting">

                        <header>



                            <div class="page-header clip_content single-post">
                                            <div class="page-header">
                                                <h1 class="single-title-wg" itemprop="headline">
                                                                                                        <?php $category = get_the_category();
                                                                                                        if ($category[0]) {
                                                                                                          echo '<b>'.$category[0]->cat_name.' '.$post->ID.'</b>';
                                                                                                        }
                                                                                                        ?>
                                                </h1>
                                                                                            <h4 class="single-title" itemprop="headline">
                                                                                            <p class="lead">                                                                                                         
                                                                                                                <?php the_title(); ?>
                                                        </p>
                                                                                                           </h4>

                                            </div>


                <div class="item_footer">
                                                        </div>            
                                <?php $category = get_the_category();
                                if ($category[0]) {?>
                                <p class="authorParagraph">
                                    <?php echo '<a href="' . get_category_link($category[0]->term_id) . '" class="clearfix">' . $category[0]->cat_name . '</a></p>';
                                    }
                                    ?>
                            </div>
                            </div>

                        </header> <!-- end article header -->

                        <footer>
                            <!-- <?php the_tags('<p class="tags"><span class="tags-title">' . __("Tags","wpbootstrap") . ':</span> ', ' ', '</p>'); ?> -->
                        </footer> <!-- end article footer -->

                    </article> <!-- end article -->



                    <?php endwhile; ?>          

                    <?php else : ?>

                    <article id="post-not-found">
                        <header>
                            <h1><?php _e("Not Found", "wpbootstrap"); ?></h1>
                        </header>
                        <section class="post_content">
                            <p><?php _e("Sorry, but the requested resource was not found on this site.", "wpbootstrap"); ?></p>
                        </section>
                        <footer>
                        </footer>
                    </article>

                    <?php endif; ?>

                </div> <!-- end #main -->

            </div> <!-- end #content -->

<?php get_footer(); ?>
0
, , , Radenko Zec 1 year 2020-07-20T17:10:22-05:00 0 Answers 68 views 0

Leave an answer

Browse
Browse