• Hi,

    I would use the_title_attribute as a id value in a HTML Tag to use the value of id in CSS, for example :

    <?php if (have_posts()) :
     while (have_posts()) :?>
     <h1 id="<?php the_title_attribute(); ?>"><?php the_title('','</h1>');
     the_post();
     the_content();
     endwhile;
     endif;
    ?>

    This code works fine, but when the_title_attribute returns a string with space character, I can’t use it in CSS file.

    How can I remove space in the_title_attribute? I’ve tested different PHP functions, but I’m not a PHP developer, and anything works.

    Any other function I can use ?

    Thanks for help.

    Jenny

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Use the_title of post as id value’ is closed to new replies.