Please help someone, a template tag problem

Discussion in 'WordPress' started by Rajnish357, Oct 20, 2011.

  1. #1
    Can you please tell me what is the error in this wordpress template tag:

    <?php echo do_shortcode('[audio src="<?php $values = get_post_custom_values("video"); echo $values[0]; ?>" loop="true" preload="true"]'); ?>
    PHP:
    I am using a shortcode as template tag and trying to get the audio source from a custom field on new post page, but not working.
     
    Rajnish357, Oct 20, 2011 IP
  2. Rajnish357

    Rajnish357 Well-Known Member

    Messages:
    157
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #2
    Please reply someone, I really need help. And As Soon As Possible.
     
    Rajnish357, Oct 20, 2011 IP
  3. LGRComp

    LGRComp Well-Known Member

    Messages:
    516
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    195
    #3
    Try this it might work. I could not test it.

    <?php echo do_shortcode('[audio src="'.get_post_meta($post->ID, 'video', true).'" loop="true" preload="true"]');
    ?>
    Code (markup):
     
    LGRComp, Oct 20, 2011 IP
  4. Rajnish357

    Rajnish357 Well-Known Member

    Messages:
    157
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #4
    Thanks for the reply LGRComp,
    But That also not worked.
     
    Rajnish357, Oct 21, 2011 IP
  5. LGRComp

    LGRComp Well-Known Member

    Messages:
    516
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    195
    #5
    Well do you get any kind of error or output in the code? Hard to help with out being able to see what the result is. Is the custom field value the correct name? It looks like you are trying to use a video link in an audio shortcode?
     
    LGRComp, Oct 21, 2011 IP
  6. Rajnish357

    Rajnish357 Well-Known Member

    Messages:
    157
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #6
    OH! So Sorry, You are right I was getting video field in audio code thats why its not working. Now after correcting it, it started working perfectly. Thanks.

     
    Rajnish357, Oct 21, 2011 IP
  7. LGRComp

    LGRComp Well-Known Member

    Messages:
    516
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    195
    #7
    Good to hear cause I was pretty sure that code should have worked to get the custom field info.
     
    LGRComp, Oct 21, 2011 IP
  8. Rajnish357

    Rajnish357 Well-Known Member

    Messages:
    157
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #8
    Can you please help me one more time LGRComp,
    I am using this
    <?php $values = get_post_custom_values("lyrics"); echo $values[0]; ?>
    PHP:
    to get the lyrics I am adding in the custom field, but when I am adding content like:
    means line by line

    BUT it outputs it like:
    That means in single line
     
    Rajnish357, Nov 7, 2011 IP