Any post with H2 or H3 tags are showing part of their content on the index.php

Using WordPress 4.4.2

My posts display normally on the main page. But if one of those posts has a H2 or H3 tag in it, the words that are in the h2 or h3 tags in the actual post content will display on the main page.

Here is an example below, 4 different posts, but only post #2 has an actual H2 tag inside of it in it’s content. It will display like this on the main page.

Example:

Link/post #1
Link/post #2
HELLO THIS IS A test
Link/post #3
Link/post #4

How do I prevent my main index.php from displaying anything. I only want the post links and not the content.

Thanks

This is almost certainly a problem with your theme or its settings. It’s likely that we’d need to see code for the template that’s being used for the front page to answer the question.

What if there are multiple heading tags? Say, an <h2> and two <h3> tags? Would it list them all, or is it just grabbing the first one?

What theme are you using, can you either give us a name to find it, or perhaps post the code for The Loop for that home page template?

It will list them all. H2 and H3 tags.

I am using the Univermag theme.

Not sure which code you want me to paste. single.php, index function?

Thanks

Yeah, if we’re talking about just the landing page, and it’s a blog style page, we’re probably looking at the index.php where it loops to display posts, or just the whole thing if you need to.

Here is the index.php code. Cannot find it.

`<?php 
global $dankovData;
$count = 0;
$sidebarOff = ( isset($dankovData['blog_sidebar_position']) && $dankovData['blog_sidebar_position'] != null ) ? $dankovData['blog_sidebar_position'] : 'sidebar-right'; ?>
<?php get_header(); ?>
    <div class="container cont-wide">
            <div class="row" data-sticky_parent>
            <div class="col-lg-2 col-left <?php echo $sidebarOff; ?>">
                <?php if ( is_active_sidebar( 'sidebar-mini' ) ) : ?>
                    <div class="sidebar sidebar-mini">
                        <?php dynamic_sidebar( 'sidebar-mini' ); ?>
                    </div>
                    <?php else: ?>  
                    <div class="sidebar sidebar-mini">
                        <div class="widget-line"><h3 class="widget-title">Mini Sidebar</h3></div>
                            <div class="textwidget">Mini sidebar for ads and other widgets</div>
                    </div>                    
                <?php endif; ?>
                </div>
                <div class="col-lg-6 col-md-7 col-cus-7 col-sm-12 col-content <?php echo $sidebarOff; ?>" data-sticky_column>
                    <div class="wrap-content">
                    <!-- royal slider -->
                    <?php
                        /*-------------------------------------------
                            2.1 - Featured Posts
                        -------------------------------------------*/
                        if ( get_option('sticky_posts') ) {
                            $rsquery_args = array(
                                'post__in'              => get_option('sticky_posts'),
                                // 'posts_per_page'        =>
                                'order'                 => 'DESC',
                                'orderby'               => 'date',
                                'paged'                 => 1,
                                'post_status'           => 'publish',
								'ignore_sticky_posts'   => 'false',
                                
				
                            );
                            /*--- Loop -----------------------------*/
                            $rsliderQuery = new WP_Query( $rsquery_args ); ?>
                                <div class="posts-featured-wrapper slider-main">
                    <?php if ($rsliderQuery->have_posts()) : ?>
                                    <div id="dankov-video-gallery" class="royalSlider videoGallery rsDefault">
                    <?php
                                        while ( $rsliderQuery->have_posts() ) : $rsliderQuery->the_post();  
                                            // Meta
                                            $post_link = get_permalink();
                                            $post_cats  =  wp_get_post_categories( $post->ID );
                                            $get_post_tags = get_the_tags( $post->ID );
                                            $print_post_tags = array();
                                            if ($get_post_tags && count($get_post_tags) > 0) {
                                                $get_post_tags = array_slice($get_post_tags, 0, 3);
                                                foreach ($get_post_tags as $oneTag) {
                                                    $tag_link = get_tag_link($oneTag->term_id);
                                                    $print_post_tags[] = '<a href="'. $tag_link .'">'.$oneTag->name.'</a>';
                                                }
                                                $print_post_tags = implode(", ", $print_post_tags);
                                            }
                                            if ($post_cats && count($post_cats) > 0) {                                      
                                                $post_cat  =  $post_cats[0];
                                                $post_cat_name = get_cat_name( $post_cat );
                                                $post_cat_link = get_category_link( $post_cat );
                                            } else {
                                                $post_cat_name = null;
                                                $post_cat_link = null;
                                            }
                                            $post_time    =  get_the_date('F j, Y');
                                            $post_format  =  get_post_format( $post->ID );
                                            $post_views   =  dankov_get_post_views( $post->ID );
                                            if (!$post_format) {
                                                $post_format = 'Post';
                                                $icon_type = null;
                                            } else {
                                                $icon_type = $post_format;
                                            }
                                            switch ($icon_type) {
                                                case 'standard':
                                                    $postIco = 'pencil';
                                                    break;
                                                case 'quote':
                                                    $postIco = 'speech';
                                                    break;
                                                case 'gallery':
                                                    $postIco = 'picture';
                                                    break;
                                                case 'camera':
                                                    $postIco = 'image';
                                                    break;
                                                case 'film':
                                                    $postIco = 'video';
                                                    break;
                                                case 'audio':
                                                    $postIco = 'music-tone-alt';
                                                    break;
                                                case 'link':
                                                    $postIco = 'link';
                                                    break;
                                                default:
                                                    $postIco = 'pencil';
                                                    break;
                                            }
                                            // Feat image
                                            if ( has_post_thumbnail() ) {
                                                $rs_ID = get_post_thumbnail_id( $post->ID );
                                                $rs_Thumb = wp_get_attachment_image_src( $rs_ID, $rsliderQuery->found_posts == 1 ? 'large' : 'project-medium' );
                                                $rs_Thumb = $rs_Thumb[0];
                                                $prevThumb = wp_get_attachment_image_src( $rs_ID, 'thumbnail');
                                                $prevThumb = $prevThumb[0];
                                            } else {
                                                $rs_Thumb = get_template_directory_uri() . '/assets/images/placeholder.png';
                                                $prevThumb = get_template_directory_uri() . '/assets/images/placeholder_sq.png';
                                            }
                                            $subtitle = wpautop( do_shortcode( get_the_excerpt() ) );
                                            $excerpt = $subtitle;
                                            $subtitle = implode(' ', array_slice(explode(' ', $subtitle), 0, 5));
                                            // Compose thumb
                                            $slideBody =
                                                '<div class="rsContent" style="display:none;">
                                                    <a class="rsImg" data-rsBigImg="'. esc_url($rs_Thumb) .'" href="'. esc_url($rs_Thumb) .'">
                                                        <div class="rsTmb">
                                                            <div class="rsTmb-small">
                                                                <img alt="" src="'.esc_url($prevThumb).'" />
                                                            </div>
                                                            <h5>'. esc_html(get_the_title()) .'</h5>
                                                        </div>
                                                    </a>
                                                    <div class="rsABlock sampleBlock" data-delay="0"  data-move-effect="bottom">
                                                        <div class="slider-text">
                                                            <h3><a href="' . $post_link . '">' . esc_html(get_the_title()) . '</a></h3>
                                                                
																<ul class="rsBlock-meta">'; 
                                                                    if ($post_format != 'Post') {
                                                                        $slideBody .= '<li><i class="icon-'. $postIco .'"></i> <span><a href="#" style="text-transform: capitalize;">'. $post_format .'</a></span></li>';
                                                                    }
                                                                    
																	$slideBody .= '<li></li>
																
																
                                                                </ul>
                                                            </div>
                                                        </div>
                                                    </div>';
                                            echo $slideBody;
                                        endwhile;
                                    ?>
                                    </div> </div>
                                    <script>
                                        jQuery(document).ready(function($) {
                                            var gallery = $('#dankov-video-gallery'),
                                                gallCont = gallery.find('.rsContent');
                                            gallCont.show();
                                            gallery.royalSlider({
                                                arrowsNav: false,
                                                fadeinLoadedSlide: true,
                                                controlNavigationSpacing: 0,
                                                controlNavigation: 'thumbnails',
                                                thumbs: {
                                                    autoCenter: true,
                                                    fitInViewport: true,
                                                    orientation: 'vertical',
                                                    spacing: 0,
                                                    paddingBottom: 0
                                                },
                                                transitionType: 'slide',
                                                keyboardNavEnabled: false,
                                                imageScaleMode: 'fill',
                                                imageAlignCenter:true,
                                                slidesSpacing: 0,
                                                loop: true,
                                                loopRewind: true,
                                                numImagesToPreload: 3,
                                                video: {
                                                    autoHideArrows:true,
                                                    autoHideControlNav:false,
                                                    autoHideBlocks: true
                                                },
                                                autoScaleSlider: false, 
                                                autoScaleSliderWidth: 680,     
                                                autoScaleSliderHeight: 339,
                                                imgWidth: 595,
                                                imgHeight: 339,
                                                autoPlay: {
                                                    enabled: true,
                                                    pauseOnHover: true,
                                                    delay: 5000,
                                                }
                                            });
                                        });
                                    </script>
                        <?php endif; } ?>
                    <!-- royal slider -->
                                <?php
                                    $get_cats_for_filter = array(
                                        'type'                     => 'post',
                                        'child_of'                 => 0,
                                        'parent'                   => '',
                                        'orderby'                  => 'name',
                                        'order'                    => 'DESC',
                                        'hide_empty'               => 1,
                                        'hierarchical'             => 0,
                                        'exclude'                  => '',
                                        'include'                  => '3,4',
                                        'number'                   => 2,
                                        'taxonomy'                 => 'category',
                                        'pad_counts'               => false 
                                    );
                                    $get_cats_for_filter = get_categories($get_cats_for_filter);
                                ?>
                        <div class="posts" style="margin-top:50px;">
                            <div class="widget-line">
                                <h3 class="widget-title">Latest Wrestling News:</h3>
                                <ul class="post-category univermag-post-filter-by-cat">
                                   <?php /*  <li><a href="#" class="active" data-catslug="#all">All</a></li> */ ?>
                                    <?php
                                        foreach ($get_cats_for_filter as $cat => $val) {
                                    ?>
                                 <?php /*      <li><a href="<?php echo get_category_link($get_cats_for_filter[$cat]->term_id); ?>" data-catslug="<?php echo $get_cats_for_filter[$cat]->term_id; ?>"><?php echo $get_cats_for_filter[$cat]->name; ?></a></li>  */ ?>
                                    <?php
                                        }
                                    ?>
                                </ul>
                            </div>
                            <script>
                                jQuery(function($) {
                                    "use strict";
                                    var cats = $('.univermag-post-filter-by-cat li a'),
                                        post = $('.type-post');
                                    cats.click(function(e) {
                                        e.preventDefault();
                                        cats.removeClass('active');
                                        $(this).addClass('active');
                                        var catSlug     =  $(this).attr('data-catslug'),
                                            postsGroup  =  $('.type-post'),
                                            visCount    =  0;
                                            if (catSlug !== '#all') {
                                                postsGroup.hide();
                                                postsGroup.each(function($ind, $el) {
                                                    var postCats = $($el).attr('data-catslug-post');
                                                    if (typeof postCats == 'string') {
                                                        var idsArr = postCats.split(" ");
                                                        for (var i = 0; i < idsArr.length; i++) {
                                                            if (idsArr[i] == catSlug) {
                                                                $($el).show();
                                                                visCount = $($el).is(":visible") ? (visCount+1) : visCount;
                                                            }
                                                        };
                                                    }
                                                });
                                                if (visCount === 0) {
                                                     window.location.href = $(this).attr('href');
                                                }
                                                
                                            } else {
                                                postsGroup.show();
                                            }
                                    });
                                });
                            </script>
                                    <?php
                                $stickies = get_option('sticky_posts');
                                if( $stickies ) {
                                    $args = array( 'ignore_sticky_posts' => 1, 'post__not_in' => $stickies );
                                    global $wp_query;
                                    query_posts( array_merge($wp_query->query, $args) );
                                }
                            ?>
                                <?php if ( is_sticky() && is_home() && ! is_paged() ) : ?>
                                <?php endif; ?>
<?php 
                                        if (have_posts()) :  while (have_posts()) : the_post(); 
                                            
                                                get_template_part( 'format', get_post_format() );
                                            endwhile;
                                        
                                        if ( function_exists('wp_pagenavi') ) {?>
                                        <?php } else { ?>
                                            <div id="but-prev-next"><?php next_posts_link( __( 'Older posts', 'dankov' ) ); previous_posts_link( __( 'Newer posts', 'dankov' ) ); ?></div>
                                        
                                        <?php }
                                        endif;  
                                    ?>
  <?php
// Carousel
wp_reset_query();
wp_reset_postdata();
global $dankovData;
$add_carousel = isset($dankovData['add_carousel']) ? $dankovData['add_carousel'] : true;
$qty = isset($dankovData['carousel_qty']) ? $dankovData['carousel_qty'] : 10;
if ($add_carousel) :
    $carousel_args = array(
        'tax_query' => array(
             array(
                 'taxonomy' => 'post_format',
                 'field' => 'slug',
                 'terms' => array( 
                     'post-format-audio',
                     'post-format-video'
                 )
             )
        ),
        'posts_per_page' => $qty
    );
    $carousel = new WP_Query($carousel_args);
    if ($carousel->have_posts()) :
    ?>
                            <div class="widget-line"><h3 class="widget-title"><?php _e('Recent video &amp; audio', 'dankov') ?>:</h3></div>
    <div class="under-slider-block">
                <div class="slider4">
<?php
                    while ($carousel->have_posts()) : 
                        $carousel->the_post();
                        $ID = get_the_id();
                        $title = get_the_title();
                        $thumb = null;
                        $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($ID), 'medium', true );
                        if (has_post_thumbnail()) {
                            $thumb = $thumb[0];
                        } else {
                            $thumb = get_template_directory_uri() . '/assets/images/placeholder.png';
                        }
                        $thumb = '<img src="'. esc_url($thumb) .'" alt="'. esc_attr($title) .'" />';
?>
                    <div class="slide">
    <div <?php post_class('image-slider');?>>
        <a href="<?php the_permalink() ?>" class="video-thumb video"><?php echo $thumb; ?></a>
    </div>
                    </div>
                    <?php endwhile; ?>
    </div>
    </div>
    <?php endif; ?>
<?php endif; // Carousel END ?>
                                </div><!-- #post -->        
                        </div></div>
        <?php
            if ($sidebarOff != 'sidebar-two') {
                echo '<aside class="percent-sidebar ' . $sidebarOff . '">';
                    if(isset($dankovData['blog_sidebar'])) {
                        if($dankovData['blog_sidebar'] !='') { 
                            $blog_sidebar_position = $dankovData['blog_sidebar']; 
                            dynamic_sidebar($blog_sidebar_position); 
                        }
                        else {
                            get_sidebar();
                        }                   
                    }
                    else {
                        get_sidebar();
                    }
                echo '</aside>';
            }
        ?>
                
 </div><!-- #content -->
        </div>
<?php get_footer(); ?>`

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