Risposte nei forum create
Stai visualizzando 3 post - dal 1 a 3 (di 3 totali)
-
AutorePost
-
3 Gennaio 2012 alle 10:37 in risposta a: FATAL ERROR: ALLOWED MEMORY SIZE OF (VARI NUMERETTI) #91390giggiPartecipante
Il problema si risolve aumentando (o chiedendo al proprio host di aumentare) il valore di memory limit nel file php.ini
giggiPartecipanteChiedo venia, nel copia-incolla veloce del codice in alto mi è sfuggita una linea:
DOPO
$mydesc=$mytext;
aggiungere la linea:
$external_posts=$post->ID;
Sorry...giggiPartecipanteCiao, ho avuto lo stesso problema in passato e ho scritto questa funzione (va inserita nel file functions.php del tema):
Spero possa essere d’aiuto.
#
# CREATA DA GIGGI PER INSERIRE I DATI RELATIVI AL POST PER FACEBOOK!
#
function insert_fb_in_head() {
global $post;
if ( !is_singular()) // Se non è un post o una pagina
return;
$mytext=$post->post_excerpt;
$myfulltext=strip_tags($post->post_content);
if(strlen($mytext) > 250) $mytext = substr($mytext, 0, 250).'...';
if(strlen($myfulltext) > 250) $myfulltext = substr($myfulltext, 0, 250).'...';
if(empty($post->post_excerpt)) {
$mytext=$myfulltext;
}
$mydesc=$mytext;
echo '<meta property="fb:admins" content="INSERISCI IL TUO ID DI FACEBOOK QUI!" />';
echo "n";
echo '<meta property="og:title" content="' . get_the_title() . '" />';
echo "n";
echo '<meta property="og:type" content="article" />';
echo "n";
echo '<meta property="og:description" content="' . $mydesc . '" />';
echo "n";
echo '<meta property="og:url" content="' . get_permalink() . '" />';
echo "n";
echo '<meta property="og:site_name" content="INSERISCI IL NOME DEL TUO SITO QUI!" />';
echo "n";
echo '<meta property="og:locale" content="it_IT" />';
echo "n";
$myurl = wp_get_attachment_image_src( get_post_thumbnail_id($external_posts), 'thumbnail' );
$postimage=$myurl[0];
if(empty($postimage)) {
$default_image="INSERISCI LA URL DELL'IMMAGINE DI DEFAULT SE IL POST NON HA UNA SUA IMMAGINE!";
echo '<meta property="og:image" content="' . $default_image . '" />';
}
else {
$default_image=$postimage;
echo '<meta property="og:image" content="' . $default_image . '" />';
}
echo "n"; echo "n";
}
add_action( 'wp_head', 'insert_fb_in_head', 1 );
-
AutorePost
Stai visualizzando 3 post - dal 1 a 3 (di 3 totali)