mardi 10 novembre 2015

How can I show only tags in The Loop?

Is there a way to force The Loop to show only <h1> tags from the content of a post, while ignoring all other tags (h2, p, hr... )?

  <div id="intro">
  <?php
  $hm_intro = new WP_query(array(
  'p' => 375,
  'post_type' => 'any',
  'posts_per_page' => 1
  ));
  if($hm_intro->have_posts()) : while($hm_intro->have_posts()) : $hm_intro->the_post();

  //Here I want display only the <h1></h1> from the_content().

  endwhile;
  wp_reset_postdata();
  endif;
  ?>
  </div>

Aucun commentaire:

Enregistrer un commentaire