Archivio

Archivio dell'autore

Using microdata RDFa with Breadcrumb NavXT 4.4 (schema.org)

agosto 8, 2013 3 commenti

I’ve worked hard to accomplish to set up RDFa microdata in Breadcrumb NavXT plugin on my WordPress site (http://gak.it) for a structured data breadcrumb (for Google seo and serp).
I’ve searched on internet and found these very interesting articles:

But they where not working because of the new 4.3 version  of Breadcrumb NavXT. Quoting from this article:

Since Breadcrumb NavXT 4.3.0, all settings that can contain HTML are passed through wp_kses(). With this change, only a basic set of acceptable tags and properties within tags were allowed. […] . However, with Breadcrumb NavXT 4.4, a new filter bcn_allowed_html has been introduced to fix this issue.

Finally the right idea was taken from the very same article, and combining all toghether i’ve solved the problem.

At body tag you have to add the red lines. Blue lines are optional. They are an if statemant that check if the plugin is active):

<body <?php if(function_exists(‘bcn_display’)){?>
itemscope itemtype=”http://schema.org/WebPage&#8221;
<?php }?>
<?php body_class(); ?> id=”body”>

In your theme file (in my case is in header.php), near your breadcrumb section you have to wrote the xmlns file.
Red lines are my lines. But you have to have also the blue lines that display the Breadcrumb via bcn_display() function.

<div itemprop=”breadcrumb”>
<span xmlns:v=”http://rdf.data-vocabulary.org/#”&gt;
<?php if(function_exists(‘bcn_display’))
{ bcn_display(); }?>
</span>
</div>

From version 4.3 you also have to set a filter in your function.php theme file, otherwise all the extra-attributes (itemscope, :v,  etc) will be removed. I’ve worked hard these day to finally find this working code (a little be redundant, but i preferred to add more values to tags).

In function.php of your theme you have to add all the following lines:

// 42 – 08/08/2013 – adding a tag to the allowed HTML list for Breadcrumb NavXT

function my_bcn_allowed_html($allowed_html)
{
$allowed_html[‘li’] = array(
‘title’ => true,
‘class’ => true,
‘id’ => true,
‘dir’ => true,
‘align’ => true,
‘lang’ => true,
‘xml:lang’ => true,
‘aria-hidden’ => true,
‘data-icon’ => true,
‘itemref’ => true,
‘itemid’ => true,
‘itemprop’ => true,
‘itemscope’ => true,
‘itemtype’ => true,
‘property’ => true,
‘xmlns:v’ => true
);

$allowed_html[‘span’] = array(
‘title’ => true,
‘class’ => true,
‘id’ => true,
‘dir’ => true,
‘align’ => true,
‘lang’ => true,
‘xml:lang’ => true,
‘aria-hidden’ => true,
‘data-icon’ => true,
‘itemref’ => true,
‘itemid’ => true,
‘itemprop’ => true,
‘itemscope’ => true,
‘itemtype’ => true,
‘rel’ => true,
‘typeof’ => true,
‘property’ => true,
‘xmlns:v’ => true
);

$allowed_html[‘div’] = array(
‘title’ => true,
‘class’ => true,
‘id’ => true,
‘dir’ => true,
‘align’ => true,
‘lang’ => true,
‘xml:lang’ => true,
‘aria-hidden’ => true,
‘data-icon’ => true,
‘itemref’ => true,
‘itemid’ => true,
‘itemprop’ => true,
‘itemscope’ => true,
‘itemtype’ => true,
‘rel’ => true,
‘typeof’ => true,
‘property’ => true,
‘xmlns:v’ => true
);

$allowed_html[‘a’] = array(
‘title’ => true,
‘class’ => true,
‘id’ => true,
‘dir’ => true,
‘align’ => true,
‘lang’ => true,
‘xml:lang’ => true,
‘aria-hidden’ => true,
‘data-icon’ => true,
‘itemref’ => true,
‘itemid’ => true,
‘itemprop’ => true,
‘itemscope’ => true,
‘itemtype’ => true,
‘rel’ => true,
‘typeof’ => true,
‘property’ => true,
‘xmlns:v’ => true,
‘href’ => true
);

return $allowed_html;
}
add_filter(‘bcn_allowed_html’, ‘my_bcn_allowed_html’);

if you know what are you doing you can also add or remove some attribute, but be carefull, these values override the default ones, so e.g. if you remove the href attribute from the <a> tag it will be automatically stripped. It will be indeed no more recognized because the default values where overriden.

For verifying the correct results, you can use the Google Structured Data Testing Tool

Enjoy ^_^

[Risolto] – Errore fatale con il plugin di WordPress – MyEasyBackup.

febbraio 8, 2012 1 commento

Oggi vediamo un bug che blocca completamente la visualizzazione del vostro sito wordpress, trattandosi un errore fatale che blocca il completamento del caricamento della pagina. Si verifica se avete attivo  il plugin MyEasyBackup, dopo aver fatto un backup/importazione del database in locale (e forse può capitare anche online se si cambia cartella)

L’errore mostrato a schermo è simile a questo;

L’esecuzione dello script è stata fermata:require_once() [function.require]: Failed opening required ‘I:/EasyPHP/www/wp-content/plugins/myeasybackup/inc/class.php5.addDir.php’ (include_path=’.;I:\EasyPHP\www\;’) — 64

In pratica non riesce a trovare un file e si blocca. Ciò avviene se avete il vostro sito non nella cartella base del vostro spazio/dominio. Io avendo in locale diversi siti, li ho in sottocartelle del server virtuale di EasyPhp. Lo script non considera le sottocartelle e quindi cerca il file nella posizione sbagliata.

Per risolverlo basta cambiare1 sola riga. Aprite il file meb-config.php in  [cartella base dell’installazione di wordpress/wp-content/plugins/myeasybackup/meb-config.php

Alla riga 110 troverete questa riga:

 define(‘MEBAK_PATH’, $_SERVER[‘DOCUMENT_ROOT’] . ‘/wp-content/plugins/myeasybackup/’ );

basta sostituirla con questa:

//    define(‘MEBAK_PATH’, $_SERVER[‘DOCUMENT_ROOT’] . ‘/wp-content/plugins/myeasybackup/’ );
define(‘MEBAK_PATH’, dirname(__FILE__) . ‘/’); //  Risolve un bug locale

Ho commentato ( con il doppio slash) la vecchia istruzione errata, e ne ho aggiunta una nuova nella riga sotto, commentando anche con ” Risolve un bug locale”.

Spero vi sia stato utile.

Have fun !

 
 

 

 

 

 

[Risolto] Fatal error: Maximum execution time of 30 seconds exceeded in \wp-includes\class-http.php on line 1078

novembre 2, 2011 Lascia un commento

Se wordpress vi da problemi nell’aggiornamento fornendo un errore del tipo :

Fatal error: Maximum execution time of 30 seconds exceeded in [vostro url]\wp-includes\class-http.php on line 1078

per risolverlo basterebbe modificare il massimo tempo di esecuzione degli script nel file php.ini. tuttavia ciò è altamente sconsigliato per conseguenze negative sulle prestazioni.
Per risolvere facilmente il problema senza compromettere le prestazioni generali basta inserire all’inizio del file \wp-includes\class-http.php la seguente espressione:

set_time_limit (0);

in tal modo solo per questa pagina vengono eliminati i limiti di tempo e voi potete aggiornare tranquillamente il vostro blog.