Support » Themes and Templates » Excerpt Generating Weird Code

  • Hi,
    If you go on and look at the page source, you see the meta description in the header as:
    <meta name="description" content="Share(function() { var s = document.createElement('SCRIPT'), s1 = document.getElementsByTagName('SCRIPT')[0]; s.type = 'text/javascript'; s.async = true; s.src = ''; s1.parentNode.insertBefore(s, s1); })(); Tweet(function() { var s = document.createElement('SCRIPT'), s1 = document.getElementsByTagName('SCRIPT')[0]; s.type = 'text/javascript'; s.async = true; s.src = ''; s1.parentNode.insertBefore(s, " />

    In the theme header.php itself, the code is defined as:

    <meta name="description" content="<?php the_excerpt_rss(); ?>" />

    So my conclusion is, for some reason, the_excerpt_rss is messed up, giving that code. Because of that, my Facebook META tags plugin is also taking that code as the description (which will be a big issue). Anyone know why that code is being generated so I can fix it as soon as possible?

    I also have All In One SEO pack installed, but og:description will override the description from All In One SEO Pack and make sharing on Facebook impossible. HELP!

Viewing 11 replies - 1 through 11 (of 11 total)
  • Well, I figured out that Sharebar is messing up the excerpt, specifically the Digg button. Even if I leave the Facebook share and Tweet button in, it adds “Share Tweet” right before the description of the post which is not good for me. Anyway to prevent it from doing this?

    I’m having the same exact problem. I even tried using CevherShare which is like Sharebar and it does the same thing. I contacted the plugin creators for both and they don’t know why it does this but they say it’s not from their plugin. It has to be a problem with their plugin.

    I tried DiggDigg bar and I never had problems with this. However, DiggDigg bar is unstable and doesn’t show up on all computers for some reason.

    Someone please help us. This issue is really annoying and is destroying conversion rates of people who share our content on Facebook as it adds weird code for the description.



    Forum Moderator

    it probably is caused by the seo plugin (or your theme’s meta description code) that is grabbing some unfiltered excerpt code; in combination with the share plugins which are hooking into the excerpt before the seo plugin is getting it.

    link to your site?


    By the way, I don’t have an seo plugin installed. I thought that could have been the problem too, so then I deleted the all in one seo pack and it’s still doing the same thing.



    Forum Moderator

    have you an idea what code does the meta description:

    for example: <meta name="description" content="ShareTweet(function() { var s = document.cre......

    this might be in header.php, or a function in functions.php, or a plugin.

    the meta description is clearly showing some unfiltered code from another plugin.

    I’m not sure. I’m using the Freemium Theme. I wonder if there’s a plugin that can fix this like a “meta description plugin”

    I just found “Description for Facebook” wordpress plugin. It works!!! However, I doubt this resolves the issue for seo. I noticed my search engine traffic has declined severely. When I googled a phrase I was indexed for the description says: ShareTweet(function() { var s = document.createElement(‘SCRIPT’), s1 = document.getElementsByTagName(‘SCRIPT’)[0]; s.type = ‘text/javascript’;

    This is obviously why I’m not getting indexed much anymore. I’ve gotta figure this issue out now.

    I just looked at functions.php and this is all it says:

    if ( function_exists(‘register_sidebars’) )
    register_sidebars(2, array(
    “before_title” => “<h2><span>”,
    “after_title” => “</span><small></small></h2>”

    Header.php doesn’t appear to be where the description is. I think it’s supposed to be in themes.php and it’s missing.

    This is caused by themes treating code inserted by other plugins as legit post content, so whenever your blog tries to display content, code gets displayed with it, especially if the code is added to the beginning of the content. In the EvoLve theme, for example, the following code shows exactly that:

    <?php if ( get_the_content() ) { ?> &mdash; <small style="font-style:italic;"><?php $postexcerpt = get_the_content();
    $postexcerpt = apply_filters('the_content', $postexcerpt);
    $postexcerpt = str_replace(']]>', ']]>', $postexcerpt);
    $postexcerpt = strip_tags($postexcerpt);
    $postexcerpt = strip_shortcodes($postexcerpt);
    echo truncate($postexcerpt, 60, '...');
     ?></small> <?php } ?>

    postexcerpt contains the “ShareTweet(function() { var s = document.createElement(‘S …”, which is the code generated from my “Social Media Counters” plugin, which I’ve set to be shown both at the top and bottom of my posts. The question is which of these should work to resolve the issue, the theme folks or the plugin folks … or both?

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Excerpt Generating Weird Code’ is closed to new replies.