• When I use the default search widget on my wordpress website, results/pages that have a featured image associated with it display the embedded html link for that image at the beginning of the text for that result.

    Example – the search results display will include the following:
    <iframe frameBorder=”0″ scrolling=”no” src=”https://www.”my website”.com/?ig_embed_widget=1&product_no=6″ width=”214″ height=”366″></iframe>

    How do I remove this from my search results???!! Can’t make my website live until I fix this. Please help.

Viewing 4 replies - 1 through 4 (of 4 total)
  • I had a similar problem with the search results echoing the caption as html. I had to strip out the html using this:

    <?php $content = strip_tags(get_the_content(), '<p><a><h2><blockquote><code><ul><li><i><em><strong>');
    								$content = preg_replace("/\[caption.*\[\/caption\]/", '', $content);
    								$content = str_replace("[/caption]", '', $content);
    								echo Str::limit ($content, 120);
    								?>
    Thread Starter bensylevine

    (@bensylevine)

    Thanks jelly_bean for the quick response!

    Not being a coder, that looks intimidating. Would I put that code in my search.php?

    And do you think that will work for my problem? The problems seems different.

    Thanks!

    Sorry, I should have told you where to put the code. Yes I think it will work becaue it looks like your search results need to have the code stripped from it so that it only shows the text rather than the code.

    Your search results should be controlled by your archive page found in themes/your_template/templates/archive.php

    or it may be called archive-search.php or a variation of that.

    Find <?php if( get_the_content() ) : ?> and place the code underneath that.

    Let me know how you get on.

    Thread Starter bensylevine

    (@bensylevine)

    Would you mind taking a look at my archive.php, I’ve pasted it below. There is not <?php if( get_the_content() ) : ?> but that similar call may just have a different wording for me. I didn’t want to screw around too much though. Any thoughts on what to do given what my archive.php looks like? Thanks a million.

    Here is my archive.php:

    <?php get_header(); ?>
    
    <div class="colored-line"></div>
    
    <section id="main">
    	<div class="shell shell-inner-page">
    		<div class="container clearfix left">
    			<section id="content" <?php post_class('left'); ?>>
    				<article class="entry">
    					<section>
    
    						<?php js_breadcrumbs($post->ID); ?>
    
    						<h1><?php $post = $posts[0];
    							if (is_home()):
    								echo get_the_title( get_option('page_for_posts', true) );
    							elseif (is_category()):
    								single_cat_title();
    							elseif(is_tag()) :
    								_e('Tagged','crowdpress'); ?>: “<?php single_tag_title(); ?>”<?php
    							elseif (is_day()) :
    								_e('Archive for','crowdpress'); echo ' '; the_time('F jS, Y');
    							elseif (is_month()) :
    								_e('Archive for','crowdpress'); echo ' '; the_time('F, Y');
    							elseif (is_year()) :
    								_e('Archive for','crowdpress'); echo ' '; the_time('Y');
    							elseif (is_author()) :
    								_e('Author Archive','crowdpress');
    							else :
    								_e('Archives','crowdpress');
    							endif; ?>
    
    						</h1>
    
    						<?php if ( have_posts() ) : ?>
    
    							<?php while (have_posts()) : the_post(); ?>
    
    								<?php get_template_part('single-post-block'); ?>
    
    							<?php endwhile; ?>
    
    						<?php endif; ?>
    
    						<?php js_get_pagination(); wp_reset_query(); ?>
    
    					</section>
    				</article>
    
    			</section>
    			<aside class="right">
    				<?php get_sidebar(); ?>
    			</aside>
    			<div class="cl"></div>
    
    		</div>
    	</div>
    </section>
    
    <?php get_footer(); ?>
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Featured Image embedded html text show in search results display’ is closed to new replies.