I've got a blog that isn't a part of my primary site's script. I have drawn within the blog title, thumbnail picture, and excerpt all right around the frontpage. However, when the blog text has apostrophes or even the such as the started out text will get screwed on the frontend, leading to strange figures instead of the apostrophes. I have looked everywhere regarding how to fix this, but came up empty.
It seems I have to make use of the esc_html() function, but I am unsure how to achieve that using theclip. I am certainly not really a PHP guy.
I've this code:
<?php while (have_posts()): the_post(); ?> <h3><?php the_title(); ?></h3> <img style="float: left; padding: 13px 20px 0px 0px;" src="<? echo catch_that_image(); ?>" width="100"> <?php the_excerpt(); ?> <p><a href="<?php the_permalink(); ?>">Read more...</a></p> <?php endwhile; ?>
Does anybody understand how to fix this therefore the excerpt's text is not changing apostrophes and quotes with strange figures?
the_excerpt directly results content. Rather, use get_the_excerpt to come back this content and set it inside a variable, or create it for
<?php echo esc_html(get_the_excerpt()); ?>
For many Wordpress functions from the format the_X(), get_the_X() also is available.
the_excerpt() normally produces valid output by itself, so you might want to verify the character sets involving the site and Wordpress match. That will mean your site's page ought to be provided as utf-8.
Sure you are working with similar character set encoding in every page's header?:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
or calling blog-header around the non-Wordpress pages?
<?php require('/the/path/to/your/wp-blog-header.php'); ?>