• davidhelp

    (@davidhelp)


    Hello, please help me, how to add in text posts write the URL of the current post?

    For example:
    link on my posts is: http://www.forum.com/theme/this-is-test-posts

    I want to write the URL of the posts in the text of the posts: this-is-test-posts.

    It is possible? Is there any shortcode or plug-in?

    Well thank you

Viewing 3 replies - 1 through 3 (of 3 total)
  • Felipe Elia

    (@felipeelia)

    You can add this code to your functions.php:

    function post_slug_shortcode() {
    	global $post;
    	return $post->post_name;
    }
    add_shortcode( 'post_slug', 'post_slug_shortcode' );

    and use [post_slug] in the content.

    Thread Starter davidhelp

    (@davidhelp)

    Thank you, its working.

    But I have next problem. If i use this shortcode, its working, but if i want this shortcode in onther shortcode for example: [mbhi_hours location=”[post_slug]”], dont work.

    Please, can you help me?

    Thanks.

    Felipe Elia

    (@felipeelia)

    Hm, in that case another shortcode wouldn’t be the best option.

    I gave a look at the Business Hours Indicator plugin code and what you are trying to accomplish doesn’t seem to be possible, as it (apparently) doesn’t provide any hook to allow the manipulation of the location attribute.

    But that is just my opinion, the best people to really tell you that are the folks of the Bussiness Hours Indicators themselves.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘How display permalink in posts text’ is closed to new replies.