Support » Fixing WordPress » Get permalink/slug?

  • Resolved Anonymous

    New to using WP, well new again…

    Is there a way to get the permalink/slug to use as as ID?

    Like

    <h1 id="<?php the_permalink('title_only'); ?>"><?php the_title(); ?></h1>

    and it would return

    <h1 id="a-short-title">A Short Title</h1>

Viewing 2 replies - 1 through 2 (of 2 total)
  • microkid

    (@microkid)

    try this:

    <h1 id="<?=$post->post_name?>"><?php the_title(); ?></h1>
    Anonymous

    Excellent! Thank you, thank you, and thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Get permalink/slug?’ is closed to new replies.