function catch_that_video() {
global $post, $posts;
$first_video = '';
ob_start();
ob_end_clean();
$output = preg_match_all('/http:\/\/www.youtube.com\/watch\?v=(.+)&/', $post->post_content, $matches);
$first_video = $matches[1][0];
if(empty($first_video)){
$first_video = "";
}
return $first_video;
}
function remove_first_video ($content) {
if (!is_page() && !is_feed() && !is_feed() && !is_home()) {
$content = preg_replace("/
venerdì 30 marzo 2012
mercoledì 28 marzo 2012
funzioni per prendere e togliere la prima immagine del post
function catch_that_image() {
global $post, $posts;
$first_img = '';
ob_start();
ob_end_clean();
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].+>/i', $post->post_content, $matches);
$first_img = $matches [1] [0];
if(empty($first_img)){ //Defines a default image
$first_img = "";
}
return $first_img;
}
function remove_first_image ($content) {
if (!is_page() && !is_feed() && !is_feed() && !is_home()) {
$content = preg_replace("/
]+\>/i", "", $content, 1);
} return $content;
}
add_filter('the_content', 'remove_first_image');
global $post, $posts;
$first_img = '';
ob_start();
ob_end_clean();
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].+>/i', $post->post_content, $matches);
$first_img = $matches [1] [0];
if(empty($first_img)){ //Defines a default image
$first_img = "";
}
return $first_img;
}
function remove_first_image ($content) {
if (!is_page() && !is_feed() && !is_feed() && !is_home()) {
$content = preg_replace("/
} return $content;
}
add_filter('the_content', 'remove_first_image');
lunedì 26 marzo 2012
templates wordpress
FILES
index.php si riferisce alla HOME
single.php si riferisce al singolo POST
the_excerpt() scrive solo il teaser
the_date() scrive la data
index.php si riferisce alla HOME
single.php si riferisce al singolo POST
FUNZIONI
the_content() scrive tutto il contenutothe_excerpt() scrive solo il teaser
the_date() scrive la data
Iscriviti a:
Post (Atom)