I am not a coder – just a diligent reader of the Codex. Maybe this helps?
Nope, not exactly. I don’t need the permalink, e.g.
http://www.mysite.com/about-the-birds-on-the-roof/, I only need the slug, e.g. about-the-birds-on-the-roof.
I assumed you searched. I often fall into this mistake – assuming more than people are willing to do to solve their own problems…
Thanks for the help, but also for the charming sarcasm. Assuming I searched was correct. Assuming I searched exactly for “return the slug” would however be false. Try searching for only “the slug” and see how many of the useful posts from your search turn up on the first results page.
I’m trying to do exactly the same thing as mbalara. I haven’t found anything helpful in the forums though. The closest template tag to what I need is
<?php permalink_anchor('title'); ?>. That tag doesn’t echo the post slug – only an anchor (obviously). But since the slug is returned in the html code as
>I think this widely spread problem must have a solution…
<?php echo $post->post_name; ?>doesn’t seem to work.
- The topic ‘Insert the slug in a template?’ is closed to new replies.