I've got this shortcode in my functions.php:

function amaranthe_buy_tickets( $atts, $content = null ) {
        'link'  => '#',
        'target'    => '',
        'variation' => '',
        'size'  => '',
        'align' => '',
    ), $atts));

    $style = ($variation) ? ' '.$variation. '_gradient' : '';
    $align = ($align) ? ' align'.$align : '';
    $size = ($size == 'large') ? ' large_button' : '';
    $target = ($target == 'blank') ? ' target="_blank"' : '';

    $out = '<a' .$target. ' class="tickets_btn' .$style.$size.$align. '" href="' .$link. '">' .$content. '</a>';

    return $out;
add_shortcode('buy-tickets', 'amaranthe_buy_tickets');

In my template file where I want the shortcode to display, I have this:

<?php echo do_shortcode("[buy-tickets]"); ?>

and in the post, I have this:


In the output, all I get is this:

<a href="#" class="tickets_btn"></a>

For some reason, the content is missing.

closed as too localized by fuxia Jan 12 '13 at 8:00

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Impossible. Your output cannot be a result of your shortcode (href comes after class). Please add the real output, do not use the DOM inspector, use source view instead. – fuxia Jan 11 '13 at 5:37
  • this is what I get when I view source <a class="tickets_btn" href="#"></a>. I don't know what you mean "Your output cannot be a result of your shortcode href comes after class" Why does that matter? – Jamie Jan 12 '13 at 5:40
  • I does matter, because we know we are either not looking at the real output or you have overwritten the shortcode you want to fix with another shortcode that produces almost the same markup. This is important. We cannot help if the facts are obviously wrong. :) – fuxia Jan 12 '13 at 5:42
  • There is no other shortcode. That is the code word for word in my functions.php file. it's doing the shortcode but none of the content. none of the arguments are working. – Jamie Jan 12 '13 at 7:46
  • got it sorted out. There was an error in my query. – Jamie Jan 12 '13 at 7:57

It is the hyphen:

Take caution when using hyphens in the name of your shortcodes. In the following instance WordPress may see the second opening shortcode as equivalent to the first (basically WordPress sees the first part before the hyphen):

Rename your shortcode so the tag doesn't have a hyphen.

  • I think I remember something about hyphens killing the shortcode. I thought this would work but I tried it and still it's not working. It doesn't seem to be accepting the arguments either. I put in link like so link="address" and it shows the # sign in the url. – Jamie Jan 12 '13 at 5:35

Not the answer you're looking for? Browse other questions tagged or ask your own question.