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.

In my post I have a shortcode for [video] than text content. Single post page displays first entry-meta, than title, than content [video] + text. What I need is to add some condition in single.php so that the order for display to be [video] ->entry-meta ->title ->text. Or maybe there is a function to check if I have [video] shortcode in post to display it first than the title and after rest of the content. Can anyone please help?

I know that tut but I don't know how to use it in single.php.

if(has_shortcode('your_short_code')) {  
    // perform actions here  ... 
    // I want to have: do shortcode [video id] or something like this
}  

I need an example in single.php

I just want to have in single.php displayed first the [video id] after meta than Title +Content

OR

the_content([with video]);

the_content(without video);
share|improve this question
    
Use the code from this answer, and just set the video to the start of the content. –  toscho Oct 12 '12 at 9:34
add comment

1 Answer

There's a fast and easy tutorial for writing your own has_shortcode() function over at WP tuts.

share|improve this answer
    
Lone link is considered a poor answer since it is meaningless by itself and target resource is not guaranteed to be alive in the future. Please try to include at least summary of information you are linking to. –  Rarst Oct 12 '12 at 11:48
add comment

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.