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

currently i know how to make a jquery slider and pull images by get thumbnail . But is there any way to make a option (using custom post types/custom fields/meta boxes) to get a video by id and show that video in the slider?

I have seen many theme developers are using flex slider and they included option for users to add videos to the slider .

share|improve this question
up vote 0 down vote accepted

You could just paste the video(not embed) link from certain sites directly into the content editor, and wordpress takes care of displaying the video for you, and you don't have to store/serve the large video files on your server. Here's a good little write up on that: http://codex.wordpress.org/Embeds

If you have some need to add separation between the video and the posts content, you could use a simple custom field, or build a meta box, then paste video "embed" links from sites like youtube, into the field/box. Then you can display a specific video for your slide.

There's a number of video sites, like youtube, that provide an embed link for showing your videos elsewhere. The page I linked to above has a list of video sites, and I think most(if not all) of them provide embed links for you to embed videos into your site.

EDIT for Sadi: To add custom field support to your custom post type, open your functions.php file, and look for the register_post_type() function for your slides post type. you should see one of the options looks something like 'supports'=>array('title', 'editor', 'custom-fields'). Note: you will likely need to add the 'custom-fields' part yourself to add custom field support to your custom post type.

Next go edit, or add a new, slide and if you don't see a new custom fields box at the bottom of the edit screen, click on "screen options"(top right area) and check off the Custom Fields box, then you will see the custom field editor at the bottom of your custom post type edit screen.

In the custom field editor box, fill in a Name like slideVideo, and paste a video(youtube) embed link into the Value text field. The name will be used to retrieve the value in the next step.

Open up your template file that is displaying slides and inside the slide loop code(presuming it's a loop) add the following code to check for your custom field and display it:

$slideVideo = get_post_meta($post->ID, 'slideVideo', true);
   echo $slideVideo;

After saving your template, and refreshing your browser, you should see the video that you pasted the embed link from. If you just see a link to your video, then you likely didn't use an embed link for the video.

share|improve this answer
yes . embedding will work for me . but do you know any good article regarding creating custom fields (similar to this topic) ? it will be better for me if you provide me some code example . or a good article . – Sadi Mahmud Oct 12 '12 at 17:25
thanks for the quick response . but turning on custom fields in 'screen options' is not so user friendly . is there any other way to make it showing from the first place? . btw i am reading on different articles about custom fields . thanks again . – Sadi Mahmud Oct 12 '12 at 18:04
That was a "just in case" blurb. I can't remember, but I think the custom fields box is visible by default when you enable support for custom fields. Give it a try! – Ben Oct 12 '12 at 18:14

Your Answer


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.