php - How to show slug on HTML id in Wordpress -
i trying id have slug such id="the_title" if title title. such use custom css n js things specific post. can using php want know if there wordpress specific code in word or two.
the_title()
here want that
<h3 class= "serviceslist" id="what put here post's slug"><?php the_title(); ?> : <a href="#"><i class="fa fa-chevron-down"></i></a></h3>
there's no built-in function displaying slug. however, can global $post object:
<h3 class= "serviceslist" id="<?php echo $post->post_name ?>"> <?php the_title() ?> : <a href="#"><i class="fa fa-chevron-down"></i></a> </h3>
Comments
Post a Comment