Disculpa,
Como lo único que deberia fallar es la funcion externa o la llamada en el loop pues fué lo que coloqué, pero aqui está todo el codigo, en todo caso, fijense que la "llamada" se encuentra en el case 5 del switch.
Código PHP:
<?php
$my_wp_query = new WP_Query();
$all_wp_pages = $my_wp_query->query(array('post_type' => 'page'));
$portfolio_children = get_page_children(5, $all_wp_pages);
$totaldestacados = count($portfolio_children);
for ($i = 0; $i < $totaldestacados; $i++) {
echo "<ul class='slide_destacat'><li>";
echo "<div id='contingut' class='videodestacat'>";
$hayyoutube = get_post_meta($portfolio_children[$i]->ID, "youtube",true);
$hayvimeo = get_post_meta($portfolio_children[$i]->ID, "vimeo",true);
$hayxiptv = get_post_meta($portfolio_children[$i]->ID, "xiptv",true);
$hayvideo = get_post_meta($portfolio_children[$i]->ID, "video",true);
if (empty($hayyoutube)){
if (empty($hayvimeo)){
if (empty($hayxiptv)){
if (empty($hayvideo)){
$hayalgo = 5;
} else {
$hayalgo = 4;
};
} else {
$hayalgo = 3;
};
} else {
$hayalgo = 2;
};
} else {
$hayalgo = 1;
};
switch ($hayalgo){
case "1":
echo "<embed src='http://www.youtube.com/v/";
echo get_post_meta($portfolio_children[$i]->ID, "youtube", true);
echo "&hl=es&fs=1&rel=0&showinfo=0' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='460' height='285'></embed>";
break;
case "2":
echo "<iframe src='http://player.vimeo.com/video/";
echo get_post_meta($portfolio_children[$i]->ID, "vimeo",true);
echo "' width='460' height='259' frameborder='0'></iframe>";
break;
case "3":
echo "<script type='text/javascript' src='http://www.xiptv.cat/imgfiles/Front_xal/js/jquery-1.3.2.min.js'></script><script type='text/javascript' src='http://www.xiptv.cat/Front_xal/player/player_outside.js'></script><embed type='application/x-shockwave-flash' allowscriptaccess='always' allowFullScreen='true' src='http://www.xiptv.cat/imgfiles/Front_xal/flash/webtv_flashplayer.swf' id='starmedia_player' wmode='window' flashvars='host=http://www.xiptv.cat&tipo=1&idvideo=";
echo get_post_meta($portfolio_children[$i]->ID, "xiptv",true);
echo "&start=0&end=' width='460' height='255'/></object>";
break;
case "4":
echo "<object id='player' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' name='player' width='460' height='285'>
<param name='movie' value='";
bloginfo('template_directory');
echo "/swf/player-viral.swf' />
<param name='allowfullscreen' value='true' />
<param name='allowscriptaccess' value='always' />
<param name='flashvars' value='file=";
echo $portfolio_children[$i]->ID, "video",true;
echo "&image=";
mi_imagen($tamano = 'medio');
echo"' />
<embed
type='application/x-shockwave-flash'
id='player2'
name='player2'
src='";
bloginfo('template_directory');
echo "/swf/player-viral.swf'
width='460'
height='285'
allowscriptaccess='always'
allowfullscreen='true'
flashvars='file=";
echo $portfolio_children[$i]->ID, "video",true;
echo "&image=";
mi_imagen($tamano = 'medio');
echo "'
/>
</object>";
break;
case "5":
echo "<div id='foto_destacat_home' style='background: url(";
imagen_portada($tamano = 'grande');
echo ") center'><br></div>";
break;
default:
echo "foto";
break;
};
echo "</div>";
echo "<div id='contingut' class='fletxavideodestacat'><br />
</div>";
echo "<div id='contingut' class='textvideodestacat'>";
echo "<h6> " . $portfolio_children[$i]->post_title. "</h6>";
echo "<p> " . $portfolio_children[$i]->post_content. "</p>";
echo "<ul class='anar_cap_a'>
<li><a href='";
echo get_post_meta($portfolio_children[$i]->ID, 'anar',true);
echo "'>Més...</a></li>
</ul></div>";
echo "</li></ul>";
};
?>
Gracias!