Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I don't know whats causing the problem but the echo do_shortcode is not working on my theme's template, but its working on my plugin's template and the shortcode is working on my posts and pages. Pretty weird. Here's the code

<?php 
$my_query = new WP_Query('category_name=video post&posts_per_page=10');
while ($my_query->have_posts()) : $my_query->the_post();
$do_not_duplicate = $post->ID; 
?>

    <li>
    <h3><a href = "<?php the_permalink();?>"><?php the_title();?></a></h3>
    <?php the_post_thumbnail(); ?>                          
    <p> 
    <?php the_excerpt();?>
    <?php                                       
    $urlbox = get_video_box();

    echo $urlbox[0]; // echo out the url of a post                     
    echo $urlbox[1]; // echo out the url description of a post
    echo do_shortcode('[jwplayer config="Out-of-the-Box" file="' . $urlbox[0] . '" image="http://www.mywebsite.com/myimage.jpg"]');
    ?>          

    </p>
    </li>

<?php endwhile; ?>  

I am using the JW player plugin, again, the shortcode is working on the plugin's template and post/page . but on my theme's template its not working.. please help me here. Thanks

share|improve this question
    
Can you provide a link to your website? It's possible that there could be conflicting scripts on that particular page. –  Nicole Oct 23 '12 at 14:08
    
Has the hook with which you add the shortcode run when the theme template is loaded? –  Johannes Pille Oct 23 '12 at 14:32
    
I don't know how but after deactivating and reactivating plugins, the code is now working. Anyway, Thanks Guys. :) –  markyeoj Oct 23 '12 at 15:18
    
I have the same issue with do_shortcode() and jwPlayer in my theme. –  david Nov 2 '12 at 17:44

1 Answer 1

up vote 1 down vote accepted

According to the developer of the jwPlayer it was necessary to implement the plugin as a filter to be able to support '.' in tag attributes. Hence do_shortcode(..) does not work but jwplayer_tag_callback(..) will return the desired result.

Matching your example simply execute:

echo jwplayer_tag_callback('[jwplayer config="Out-of-the-Box" file="' . $urlbox[0] . '" image="http://www.mywebsite.com/myimage.jpg"]');
share|improve this answer
    
Thank you so much for answer sir. –  markyeoj Nov 7 '12 at 19:10

Your Answer

 
discard

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

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