WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I created a shortcode to show the short URL from a post. I use canvas, that has an option to show shortcode after content, but I only want to show the shortcode only in posts, not in homepage.

How is possible to do that?

share|improve this question

If I understand the question:

Modify the shortcode to incorporate

<?php if (is_post()) { //do this; }?>


<?php if (is_page()) { //do this; }?>


<?php if (is_home()||is_front_page()) { //do this; }?>

The first will only do //do this; on a post, the second on a page, and the third if the post or page is the homepage.

share|improve this answer
is_post() is deprecated - use is_single() instead: codex.wordpress.org/Function_Reference/is_post – Michael Dec 29 '11 at 21:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.