Put a video in the quiz question

[ad_1]

Since you seem to be looking for HTML to edit, I’m going to assume that you are comfortable adding code to your site?

If so, adding the following to your theme’s functions.php will get you what you need. Just BACKUP OF THE FILE FIRST.

// Add some content after the featured image
function hdq_print_question_media($question)
{
	if(isset($question["hdq_featured_media"])){
		if($question["hdq_featured_media"]["value"] != ""){
			echo apply_filters( 'the_content', $question["hdq_featured_media"]["value"] );
		}
	}
}
add_action('hdq_after_featured_image', 'hdq_print_question_media');

// Add new custom "Media" field to quiz settings Extra tab
function hdq_add_featured_media_meta($fields)
{    
    $tab = "extra";
   
    if (!isset($fields[$tab]) || !is_array($fields[$tab])) {
        $fields[$tab] = array();
    }

    // set field settings
    $field = array();
    $field["name"] = "hdq_featured_media"; // should be slug format
    $field["label"] = "Media Embed";
    $field["type"] = "editor";
    $field["tooltip"] = "You can copy/paste a youtube URL to auto embed it, or use the Add Media button to add a local media file";
    array_push($fields[$tab], $field);
    return $fields;
}
add_action('hdq_add_question_meta', 'hdq_add_featured_media_meta');

The above code does two things.

  1. Adds a new editor to quiz settings Extra tab. In this editor, you can do whatever you want: add images, audio, video, etc.
  2. Adds that new content after the featured image. (note: if you are not using a featured image, that’s OK. We are placing this after where it would appear if existed)

Just note that styling the embeds will be up to you (and is why this is not built into HD Quiz). If your theme already has styles for audio/video embeds, great! If not, you will have to do this yourself.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer