Skip to content

Instantly share code, notes, and snippets.

@juque
Created July 21, 2010 03:18
Show Gist options
  • Select an option

  • Save juque/484000 to your computer and use it in GitHub Desktop.

Select an option

Save juque/484000 to your computer and use it in GitHub Desktop.
<?php
/**
* En la portada del sitio aparecerá un video
* embebido de Youtube con el tamaño ancho y alto
* dado en 'Configuración'
*
*
*/
?>
<div class="destacado">
<h3>Video</h3>
<dl class="imagenConPie">
<?php
$args = array(
'post_type' => 'post',
'posts_per_page' => 1,
'category_name' => 'Video',
);
/**
* Configuración (px)
*/
$ancho = 284;
$alto = 184;
$sql = new WP_Query($args);
if ( $sql->have_posts() )
{
while ( $sql->have_posts() )
{
?>
<dt>
<?php
$sql->the_post();
preg_match_all("/\"([^\"]\d{2,})\"/",get_the_content(),$r);
$buscar = array(
$r[0][0],
$r[0][1]
);
$reemplazar = array(
$ancho,
$alto
);
echo preg_replace($buscar,$reemplazar,get_the_content());
?>
</dt>
<dd>
<h5><a href="<?php the_permalink() ?>"><?php the_title() ?></a></h5>
<p><?php the_excerpt() ?></p>
</dd>
<?php
} // while
} // if
?>
</dl>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment