WordPress.org

Forums

Get Post slug with a WordPress function (2 posts)

  1. Potter_System
    Member
    Posted 10 years ago #

    I'm playing with in_category and switch for change the presentation of some post (inside the loop, of course). Some posts will have a image; then, I want to know how can I get the Post Slug with a WordPress default funcion for use it beyond the permalink.

    Example:
    Post title: Juan Correa
    Post slug:juan-correa
    Code:

    <h1>Post title</h1>
    <img src="images/fichas/Post slug">

    That's all

  2. Kafkaesqui

    Posted 10 years ago #

    Just echo it through the $post array:

    <img src="images/fichas/<?php echo $post->post_name; ?>">

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags