0

Hi all, I'm a newb here, but hoping someone might have the answer to my question.

Within my functions.php file, I have this code:

//Contractor Page meta box details
$contractorpage_meta_box=array();
$contractorpage_meta_box[]=array(
    'id'=>'contractor-page-meta-box',
    'title'=>'Contractor Page Details',
    'page'=>'contractor-page',
    'context'=>'normal',
    'priority'=>'high',
    'fields'=>array(
            array(
                'id'=>"header_link_heading1",
                'label'=>"First Header Link Heading",
                'name'=>"header_link_heading1",
                'type'=>"text"
            ),
            array(
                'id'=>"header_link_text1",
                'label'=>"First Header Link Text",
                'name'=>"header_link_text1",
                'type'=>"text"
            ),
            array(
                'id'=>"header_link_url1",
                'label'=>"First Header Link Url",
                'name'=>"header_link_url1",
                'type'=>"text"
            ),
            array(
                'id'=>"header_link_heading2",
                'label'=>"Second Header Link Heading",
                'name'=>"header_link_heading2",
                'type'=>"text"
            ),
            array(
                'id'=>"header_link_text2",
                'label'=>"Second Header Link Text",
                'name'=>"header_link_text2",
                'type'=>"text"
            ),array(
                'id'=>"header_link_url2",
                'label'=>"Second Header Link Url",
                'name'=>"header_link_url2",
                'type'=>"text"
            ),array(
                'id'=>"page_heading",
                'label'=>"Page Heading",
                'name'=>"page_heading",
                'type'=>"text"
            ),array(
                'id'=>"page_sub_heading",
                'label'=>"Page Sub Heading",
                'name'=>"page_sub_heading",
                'type'=>"text"
            ),array(
                'id'=>"first_intro_text",
                'label'=>"First Intro Text",
                'name'=>"first_intro_text",
                'type'=>"text"
            ),array(
                'id'=>"second_intro_text",
                'label'=>"Second Intro Text",
                'name'=>"second_intro_text",
                'type'=>"text"
            ),array(
                'id'=>"video_link",
                'label'=>"Video link",
                'name'=>"video_link",
                'type'=>"text"
            ),array(
                'id'=>"main_content_heading",
                'label'=>"Main Content Heading",
                'name'=>"main_content_heading",
                'type'=>"text" 
            ),array(
                'id'=>"main_content_text",
                'label'=>"Main Content",
                'name'=>"main_content_text",
                'type'=>"wysiwyg"
            ),array(
                'id'=>"bottom_heading",
                'label'=>"Bottom Heading",
                'name'=>"bottom_heading",
                'type'=>"text"
            ),array(
                'id'=>"bottom_content",
                'label'=>"Bottom Content",
                'name'=>"bottom_content",
                'type'=>"text"
            ),array(
                'id'=>"bottom_link_text",
                'label'=>"Bottom Link Text",
                'name'=>"bottom_link_text",
                'type'=>"text"
            ),array(
                'id'=>"bottom_link_url",
                'label'=>"Bottom Link Url",
                'name'=>"bottom_link_url",
                'type'=>"text"
            ),array(
                'id'=>"right_first_line",
                'label'=>"First Line Right Column",
                'name'=>"right_first_line",
                'type'=>"text"
            ),array(
                'id'=>"right_last_line",
                'label'=>"Last Line Right Column",
                'name'=>"right_last_line",
                'type'=>"text"
            )
        )
);

I also have this code:

// Embed YouTube videos with "youtube" shortcode

function youtube($atts) {
    extract(shortcode_atts(array(
        "value" => '',
        "width" => '475',
        "height" => '350',
        "name"=> 'movie',
        "allowFullScreen" => 'true',
        "allowScriptAccess"=>'always',
    ), $atts));
    return '<object style="height: '.$height.'px; width: '.$width.'px"><param name="'.$name.'" value="'.$value.'"><param name="allowFullScreen" value="'.$allowFullScreen.'"></param><param name="allowScriptAccess" value="'.$allowScriptAccess.'"></param><embed src="'.$value.'" type="application/x-shockwave-flash" allowfullscreen="'.$allowFullScreen.'" allowScriptAccess="'.$allowScriptAccess.'" width="'.$width.'" height="'.$height.'"></embed></object>';
}
add_shortcode("youtube", "youtube");

I'm trying to place the "video_link" from the first code into "value" from the second code (where it says "WHAT-TO-PUT-HERE".

Any help would be greatly appreciated.

0
function youtube($atts) {

    global $post;
    $value = get_post_meta($post->ID, 'video_link', true);

    extract(shortcode_atts(array(    //Make sure not to include the 'value' as part of this array. 
        "width" => '475',
        "height" => '350',
        "name"=> 'movie',
        "allowFullScreen" => 'true',
        "allowScriptAccess"=>'always',
    ), $atts));
    return '<object style="height: '.$height.'px; width: '.$width.'px"><param name="'.$name.'" value="'.$value.'"><param name="allowFullScreen" value="'.$allowFullScreen.'"></param><param name="allowScriptAccess" value="'.$allowScriptAccess.'"></param><embed src="'.$value.'" type="application/x-shockwave-flash" allowfullscreen="'.$allowFullScreen.'" allowScriptAccess="'.$allowScriptAccess.'" width="'.$width.'" height="'.$height.'"></embed></object>';

}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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