php - targeting and posting block quotes from posts -


my wordpress site's index.php has div posts title, category, , featured image of posts.

index.php html

<div>     <h1><?php the_title(); ?></h1>     <h3><?php the_category(' '); ?></h3> </div> 

i have single.php brings in , puts content of post

single.php html

<div>     <?php the_content(); ?> </div>   

i want bring section of the_content of post index.php (for example in 'block quote' tag)

ex.

 <div>     <h1><?php the_title(); ?></h1>      ... content block quote          <h3><?php the_category(' '); ?></h3> </div> 

you can retrieve content get_the_content(), check if there's blockquote and, if so, echo it:

// content $content = get_the_content(); // check , retrieve blockquote if(preg_match('~<blockquote>([\s\s]+?)</blockquote>~', $content, $matches))     // output blockquote     echo $matches[1]; 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -