put the content of a single post into og:description

I’d like to have the content of the current single post loaded into the og:description meta property – but the ‘. $content .’ doesn’t output anything? This is what’s in my header.php if (is_single()) { $content = get_the_content(); $desc=”<meta property=”og:description” content=””. $content .'” />’; echo $desc; } What could the problem be? 2 Answers 2 … Read more

Proper use of the_content filtering

This is a bit difficult without posting scads of code, but my question is: What are the benefits of filtering through apply_filters(‘the_content’, ‘anything’);, and given my example loop, am I filtering the_content excessively or inefficiently, or is there a better way? I ask because I just tried the Shareaholic plugin, which is supposed to detect … Read more

custom post type grid with content in lightbox [closed]

Closed. This question is off-topic. It is not currently accepting answers. Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third party plugins and themes are off topic, they are better asked about at their developers’ support routes. Closed 4 … Read more

Add span to the first letter of post

Example post <p>Lorem ipsum dolor sit amet</p> <p>Morbi elementum odio vel tortor adipiscing vel tempor risus ullamcorper.</p> What I have done : function first_paragraph($content){ return preg_replace(‘/<p([^>]+)?>/’, ‘<p$1 class=”first-paragraph”>’, $content, 1); } add_filter(‘the_content’, ‘first_paragraph’); Which will have different class for first paragraph Now I want add <span class=”first-letter”>L</span> and result should be like <p class=”first-paragraph”><span class=”first-letter”>L</span>orem … Read more

Content/Excerpt length control for a specific loop?

Is it possible to control the length of the content or excerpt for a specific query/loop? I have come across the following code, but this changes the length for all excerpts, I want it focused on a specific custom query. add_filter(‘excerpt_length’, ‘my_excerpt_length’); function my_excerpt_length($length) { return 20; } 2 Answers 2 Try this: http://pippinspages.com/tutorials/better-wordpress-post-excerpt-revamped/

the_excerpt(), get_the_excerpt() and the_content() all killing “the Loop”

Before I call the_excerpt(), the_permalink() displays the correct thing. Afterwards, it does not… <?php global $query_string; //strip out the “pagename=blog” so that the query will grab all of the posts instead of the content of the blog page $query_string = preg_replace(“/pagename=[a-zA-Z0-9]*/”, “”, $query_string); query_posts( $query_string . “posts_per_page=3” ); if ( have_posts() ) : while ( … Read more