Ready to get started?Download WordPress


[resolved] WordPress theme causes weird blog linking in Facebook. Description, solution. (1 post)

  1. AuntiAlias
    Posted 4 years ago #

    I have a client whose site/blog is based on the theme Web 2.0* 1.5.0 by Neil Merton. (All of Merton's websites are either gone or 403)

    The Problem:
    When linking to the site or a page of the site in Facebook, the page's content is not displayed, but a single line: "This is the personal website of..." followed by the name of the site.

    I was able to narrow the facebook excerpt problem down to this theme in two ways:
    1) I did a google search for that phrase this is the personal site of, and found other sites linked in facebook displayed that. and yes, the theme was Web 2.0* (plus, I conducted my own paste link tests of those other sites in facebook to confirm)
    2) Also, looking in the header.php file, I found the exact phrase in the meta name="description" content="" part of the file:

    <meta name="description" content="This is the personal website of <?php bloginfo('name') ?>." />

    Deleting the description resulted in displaying some CSS code in Facebook, so I couldn't just delete it. How to fix?

    The problem described in Facebook's terms:
    This page on facebook's Help Center (see "I don't have a preview for my link") described Facebook's need for 3 meta tags: title, name, and link_rel="img_src" pointed further to the fact that I'd HAVE to come up with a replacement of that existing theme code.

    The solution:
    I found the code to replace it on this page at wordpressapi.com: Customize meta description in wordpress theme or website for SEO.

    Not just for SEO, but for Facebook.

    Here's the code that I used...

    <meta name="description" content="This is the personal website of <?php bloginfo('name') ?>." />

    with this:

    <?php if (is_single() || is_page() ) : if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <meta name="description" content="<?php the_excerpt_rss(); ?>" />
    <?php endwhile; endif; else : ?>
    <meta name="description" content="<?php bloginfo('description'); ?>" />
    <?php endif; ?>

    So. Originally, this stumped me. I searched here but did not find the solution.
    Now I am writing this up for the benefit of the next person who encounters this baffling problem.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.