-
Hi,
I just saw an old post https://generatepress.com/forums/topic/using-excerpt-as-meta-description/#post-977934 which does exactly what I want, except that it displays the meta description as a paragraph.
The hook element is:
<meta name="description" content="<?php echo the_excerpt(); ?>" />
which displays as:
<meta name="description" content="<p>Let’s embark on your journey through one of Japan’s best-kept secrets and unlock a treasure trove of activities. This in-depth guide will ensure you don’t miss a beat in Kobe, capturing the essence of the Tiger City that captivates thousands each year.</p> " />
Is there an easy fix to get rid of the
<p> and </p>
?Thank you.
-
Hi there,
try this:
<meta name="description" content="<?php echo strip_tags(get_the_excerpt()); ?>" />
-
Works beautifully, thanks again!
-
You’re welcome
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.