I have a very simple Plugin at hand that adds a Meta Description to the Blog. I have slightly modified it to display also the Description in OpenGraph Protocol and Dublin Core. That was the easy part.
But i found in the Search results that the Description is shown for each and every Page.
Now I would like to add a rule that could tell the Plugin if it is in a Posting, that it should just show the_excerpt.
My idea was to simply add some rules in the and be gone with it. But I had to find out that the Plugin is called with < ?php wp_head(); ? > As I always try things first I checked the Plugin and it seemed like I found a way to change that call from
add_action( 'wp_head', 'vsmd_meta_description' );
to
add_action( 'wp_head_desc', 'vsmd_meta_description' );
Now I add in the < head > a new call < ?php wp_head_desc(); ? > check if it works, define the rules
<?php
if ( is_single() ) {
echo '<meta name="description" content="<?php the_excerpt(); ?>" />'."\n";
echo '<meta name="DC.Description" content="<?php the_excerpt(); ?>" />'."\n";
echo '<meta property="og:description" content="<?php the_excerpt(); ?>" />'."\n";
} elseif ( is_front_page() ) {
echo '<?php wp_head_desc(); ?>';
} else {
echo '';
}
?>
and be happy. Well, it is NOT that easy as it just shows in the Source only < ?php wp_head_desc(); ? > and so I am at a loss, as all I found was something about hooks what i completely don't understand at all. What i do realized is, that my change in the Plugins add_action, indeed removed it from being called by < ?php wp_head(); ? > .. So i believe that i am close to accomplishment, but right now i do not see how to get it done.
Might someone be able to enlighten me how i can call the Plugin?
Kindly Caylean