<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ordo Ab Chao - Il blog di Rocco Agostino &#187; blog</title>
	<atom:link href="http://blog.roccoagostino.eu/tag/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.roccoagostino.eu</link>
	<description>Il mio blog personale in cui si discute di libri,musica,scrittura,poesia,video,foto,news,attualità,informatica e tecnologia. Un &#34;corner&#34; da condividere con voi che commentate,criticate o apprezzate.</description>
	<lastBuildDate>Fri, 18 Nov 2011 05:48:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<atom:link rel='hub' href='http://blog.roccoagostino.eu/?pushpress=hub'/>
		<item>
		<title>Blogging Groover: Metodi per Incrementare Visite e Lettori</title>
		<link>http://blog.roccoagostino.eu/2011/11/09/blogging-groover-metodi-per-incrementare-visite-e-lettori/</link>
		<comments>http://blog.roccoagostino.eu/2011/11/09/blogging-groover-metodi-per-incrementare-visite-e-lettori/#comments</comments>
		<pubDate>Tue, 08 Nov 2011 23:08:27 +0000</pubDate>
		<dc:creator>Rocky</dc:creator>
				<category><![CDATA[Podcast]]></category>
		<category><![CDATA[Tecniche di SEO]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[bloggin grover]]></category>
		<category><![CDATA[link popularity]]></category>
		<category><![CDATA[podcast]]></category>
		<category><![CDATA[seo]]></category>
		<category><![CDATA[sviluppo siti web]]></category>

		<guid isPermaLink="false">http://blog.roccoagostino.eu/?p=923</guid>
		<description><![CDATA[<img src="http://www.roccoagostino.eu/wp/wp-content/uploads/2011/11/podcast2_p.jpg" width="38" height="38" alt="" title="Podcast" /><img src="http://www.roccoagostino.eu/wp/wp-content/uploads/2011/11/google_p.jpg" width="32" height="32" alt="" title="Tecniche di SEO" /><br/>Intervista a Paolo Console, che spiega in modo chiaro e semplice i punti essenziali per creare un blog interessante e le strategie per aumentare il link popularity e le visite.]]></description>
			<content:encoded><![CDATA[<img src="http://www.roccoagostino.eu/wp/wp-content/uploads/2011/11/podcast2_p.jpg" width="38" height="38" alt="" title="Podcast" /><img src="http://www.roccoagostino.eu/wp/wp-content/uploads/2011/11/google_p.jpg" width="32" height="32" alt="" title="Tecniche di SEO" /><br/><p>Intervista a <a title="Come creare una mole di Traffico incontrollabile verso la tua Attività Online" href="http://www.autostima.net/raccomanda/101-traffico/" target="_blank">Paolo Console</a>, che spiega in modo chiaro e semplice i punti essenziali per creare un blog interessante e le strategie per aumentare il link popularity e le visite.<br />
&nbsp;<br />
<br />
&nbsp;<br />
Fonte: <a title="Blogging Groover: Metodi per Incrementare Visite e Lettori" href="http://www.danielesalamina.it/blogging-groover-metodi-per-incrementare-visite-e-lettori" target="_blank">Blogging Groover: Metodi per Incrementare Visite e Lettori</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roccoagostino.eu/2011/11/09/blogging-groover-metodi-per-incrementare-visite-e-lettori/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://www.danielesalamina.it/wp-content/uploads/podcast/paolo-console-podcast-danielesalamina.it.mp3" length="24370104" type="audio/mpeg" />
		</item>
		<item>
		<title>Personalizzare i commenti nidificati in WordPress</title>
		<link>http://blog.roccoagostino.eu/2011/11/06/personalizzare-i-commenti-nidificati-in-wordpress/</link>
		<comments>http://blog.roccoagostino.eu/2011/11/06/personalizzare-i-commenti-nidificati-in-wordpress/#comments</comments>
		<pubDate>Sun, 06 Nov 2011 05:55:36 +0000</pubDate>
		<dc:creator>Rocky</dc:creator>
				<category><![CDATA[Informatica]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[comments]]></category>
		<category><![CDATA[funzioni]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[programmazione]]></category>
		<category><![CDATA[thumbnail]]></category>
		<category><![CDATA[web 2.0]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://blog.roccoagostino.eu/?p=910</guid>
		<description><![CDATA[<img src="http://www.roccoagostino.eu/wp/wp-content/uploads/wordpress_ico.jpg" width="33" height="33" alt="" title="WordPress" /><br/>WordPress dalla versione 2.7 supporta il threading dei commenti, ovvero l’incapsulamento di tutte le discussioni di un articolo. Il tag wp_list_comments() si prende carico della gestione delle liste nidificate, delle classi associate ad ogni livello di commento, di predisporre i link giusti e di recuperare i contenuti dei commenti. Il problema nasce quando si vuole personalizzare la modalità di visualizzazione dei commenti. In questo caso è necessario utilizzare l'opzione di callback che viene fornito nella lista degli argomenti di wp_list_comments().]]></description>
			<content:encoded><![CDATA[<img src="http://www.roccoagostino.eu/wp/wp-content/uploads/wordpress_ico.jpg" width="33" height="33" alt="" title="WordPress" /><br/><p>WordPress dalla versione 2.7 supporta il threading dei commenti, ovvero l’incapsulamento di tutte le discussioni di un articolo. Il tag <em>wp_list_comments()</em> si prende carico della gestione delle liste nidificate, delle classi associate ad ogni livello di commento, di predisporre i link giusti e di recuperare i contenuti dei commenti. Il problema nasce quando si vuole personalizzare la modalità di visualizzazione dei commenti. In questo caso è necessario utilizzare l&#8217;opzione di callback che viene fornito nella lista degli argomenti di <em>wp_list_comments()</em>.</p>
<p><span id="more-910"></span></p>
<p>Un callback è un&#8217;istruzione per eseguire un&#8217;altra funzione definita. Nel nostro caso la useremo per personalizzare il codice HTML dei commenti, pur mantenendo la possibilità di utilizzare il threading.<br />
&nbsp;</p>
<h1>Definiamo il callback</h1>
<p>&nbsp;<br />
Per prima cosa definiamo la nostra funzione di callback ed inseriamola nel file <em>function.php</em> (ovviamente ricordatevi si fare una copia di backup).<br />
&nbsp;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">function miotema_comment($comment, $args, $depth) {
	$GLOBALS['comment'] = $comment;
?&gt;
	&lt;li <span style="color: #000000; font-weight: bold;">&lt;?php</span> comment_class<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> id=&quot;li-comment-<span style="color: #000000; font-weight: bold;">&lt;?php</span> comment_ID<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;
		&lt;div id=&quot;comment-<span style="color: #000000; font-weight: bold;">&lt;?php</span> comment_ID<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;
			&lt;div class=&quot;comment-author vcard&quot;&gt;
				<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> get_avatar<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$comment</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">comment_author_email</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">48</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
				<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;cite class=&quot;fn&quot;&gt;%s&lt;/cite&gt; &lt;span class=&quot;says&quot;&gt;says:&lt;/span&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> get_comment_author_link<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
			&lt;/div&gt;
			<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$comment</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">comment_approved</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'0'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
				&lt;em&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> _e<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Il tuo commento è in attesa di moderazione.'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/em&gt;
				&lt;br /&gt;
			<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
			&lt;div class=&quot;comment-meta commentmetadata&quot;&gt;
				&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #990000;">htmlspecialchars</span><span style="color: #009900;">&#40;</span> get_comment_link<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$comment</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">comment_ID</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'%1$s at %2$s'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> get_comment_date<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>  get_comment_time<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;
				<span style="color: #000000; font-weight: bold;">&lt;?php</span> edit_comment_link<span style="color: #009900;">&#40;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'(Edit)'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'  '</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
			&lt;/div&gt;
                        &lt;/br&gt;&lt;/br&gt;
			<span style="color: #000000; font-weight: bold;">&lt;?php</span> comment_text<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
			&lt;div class=&quot;reply&quot;&gt;
				<span style="color: #000000; font-weight: bold;">&lt;?php</span> comment_reply_link<span style="color: #009900;">&#40;</span><span style="color: #990000;">array_merge</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$args</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'depth'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$depth</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'max_depth'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$args</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'max_depth'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
			&lt;/div&gt;
		&lt;/div&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>&nbsp;<br />
Vediamo quale funzione entra in gioco.<br />
&nbsp;<br />
<span style="color: #ff0000;"><em>comment_class()</em></span><br />
Questa funzione crea un elenco di classi come class = &#8220;classe1 class2 class3&#8243; per identificare i commenti pari/dispari, la profondità attuale dei commenti o altro.<br />
&nbsp;<br />
<span style="color: #ff0000;"><em>comment_ID()</em></span><br />
L&#8217;ID è il numero univoco del commento in corso.<br />
&nbsp;<br />
<span style="color: #ff0000;"><em>get_avatar()</em></span><br />
Utilizza l&#8217;e-mail per associare un gravatar. Primo parametro deve essere l&#8217;oggetto $ comment, il secondo è il formato per l&#8217;avatar, l&#8217;ultimo è l&#8217;URL di un avatar di default (deve essere URL completo).<br />
&nbsp;<br />
<span style="color: #ff0000;"><em>get_comment_link()</em></span><br />
Ottiene il link al commento in corso.<br />
&nbsp;<br />
<span style="color: #ff0000;">edit_comment_link()</span><br />
Ottiene il link per modificare il commento corrente.<br />
&nbsp;<br />
<span style="color: #ff0000;"><em>comment_text()</em></span><br />
Ottiene il testo del il commento in corso.<br />
&nbsp;<br />
<span style="color: #ff0000;"><em>comment_reply_link()</em></span><br />
Ottiene il link per rispondere al commento in corso.<br />
&nbsp;</p>
<h1>Agganciamo la nostra funzione</h1>
<p>&nbsp;<br />
Il layout che andiamo a ridefinire è quello generato proprio da <em>wp_list_comments()</em>. Per fare ciò è sufficiente fornire il parametro “callback=nome_funzione” per indicare a WordPress di ignorare il normale comportamento della funzione e utilizzare invece una nostra versione personalizzata.<br />
&nbsp;<br />
Nel nostro file comments.php andiamo dunque a modificare <em>wp_list_comments()</em> in questo modo:<br />
&nbsp;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">wp_list_comments <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'callback=miotema_comment'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>&nbsp;<br />
Ovviamente è possibile utilizzare un foglio di stile CSS per rendere i commenti gradevoli da vedere:  per esempio io ho utilizzato <a title="CSS Triangle Arrow DIVs" href="http://www.dynamicdrive.com/style/csslibrary/item/css_triangle_arrow_divs/" target="_blank">questo metodo</a> e questo è il risultato:<br />
&nbsp;<br />
<a href="http://www.roccoagostino.eu/wp/wp-content/uploads/2011/11/commenti.png"><img class="aligncenter size-full wp-image-911" title="commenti" src="http://www.roccoagostino.eu/wp/wp-content/uploads/2011/11/commenti.png" alt="" width="500" height="522" /></a><br />
&nbsp;<br />
<strong>Tutto qui. Come sempre lasciate dei commenti o magari mandatemi una e-mail. Anche eventuali suggerimenti o consigli sono sempre graditi.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roccoagostino.eu/2011/11/06/personalizzare-i-commenti-nidificati-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Thumbnails per WordPress.com Popular Posts</title>
		<link>http://blog.roccoagostino.eu/2011/10/23/thumbnails-per-wordpress-com-popular-posts/</link>
		<comments>http://blog.roccoagostino.eu/2011/10/23/thumbnails-per-wordpress-com-popular-posts/#comments</comments>
		<pubDate>Sun, 23 Oct 2011 17:49:58 +0000</pubDate>
		<dc:creator>Rocky</dc:creator>
				<category><![CDATA[In evidenza]]></category>
		<category><![CDATA[Informatica]]></category>
		<category><![CDATA[Sviluppo WEB]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[funzioni]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[programmazione]]></category>
		<category><![CDATA[thumbnail]]></category>
		<category><![CDATA[web 2.0]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[WordPress.com Popular Posts]]></category>

		<guid isPermaLink="false">http://blog.roccoagostino.eu/?p=829</guid>
		<description><![CDATA[<img src="http://www.roccoagostino.eu/wp/wp-content/uploads/css_ico.JPG" width="32" height="32" alt="" title="Sviluppo WEB" /><img src="http://www.roccoagostino.eu/wp/wp-content/uploads/wordpress_ico.jpg" width="33" height="33" alt="" title="WordPress" /><br/>Modifica del plugin WordPress.com Popular Posts per inserire nella lista degli articoli più popolari, la thumbnail associata al post.]]></description>
			<content:encoded><![CDATA[<img src="http://www.roccoagostino.eu/wp/wp-content/uploads/css_ico.JPG" width="32" height="32" alt="" title="Sviluppo WEB" /><img src="http://www.roccoagostino.eu/wp/wp-content/uploads/wordpress_ico.jpg" width="33" height="33" alt="" title="WordPress" /><br/><p>Per la visualizazione degli articoli più popolari uso il plugin <a href="http://wordpress.org/extend/plugins/wordpress-popular-posts/" target="_blank">WordPress.com Popular Post</a>. Tale plugin permette molte personalizzazioni, ma manca la possibilità di poter visualizzare le immagini riferite ai post. L&#8217;idea di fondo parte da <a href="http://www.geoffblog.com/2010/07/thumbnails-for-wordpresscom-popular.html" target="_blank">questo articolo</a> che spiega come aggiungere delle immagini all&#8217;elenco dei post con l&#8217;ausilio di uno script esterno. Senza utilizzare script esterni, possiamo, invece, sfruttare le <a href="http://blog.roccoagostino.eu/2011/10/06/modificare-il-tema-di-wordpress-parte-1-la-funzione-post-thumbnail/" target="_blank">nuove features</a> di WordPress 3.x.<br />
<span id="more-829"></span><br />
Nel momento in cui vogliamo il percorso dell&#8217;immagine associata al post il programma procederà in questo modo:</p>
<ul>
<li>cerca la thumbnail associata al post;</li>
<li>nel caso in cui il tema non supporti tale funzione o non si è inserita in fase di creazione del post, cerca la prima immagine nel post;</li>
<li>nel caso in cui il post non abbia neanche una immagine, me associa una di default.</li>
</ul>
<p>&nbsp;</p>
<p>Vediamo come:</p>
<p>&nbsp;</p>
<h1>1) Modifica del plugin</h1>
<p>&nbsp;</p>
<p>Andando in Plugin-&gt;Editor selezioniamo il plugin WPPP e quindi il file <em>wppp.php</em>.</p>
<p>&nbsp;</p>
<p>Per prima cosa troviamo il codice:</p>
<p>&nbsp;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Replace format with data</span>
<span style="color: #000088;">$replace</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
<span style="color: #0000ff;">'%post_permalink%'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> get_permalink<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$post</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'post_id'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'%post_title%'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> esc_html<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>truncateText<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$post</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'post_title'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$instance</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'title_length'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'%post_title_attribute%'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> esc_attr<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$post</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'post_title'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'%post_views%'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> number_format_i18n<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$post</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'views'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>&nbsp;</p>
<p>e aggiungiamo la seguente riga:</p>
<p>&nbsp;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$replace</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'%post_thumb%'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span>return_post_image<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'post_id'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>&nbsp;</p>
<p>A questo punto dobbiamo inserire la funzione <em>return_post_image</em>.</p>
<p>&nbsp;</p>
<h1>2) Modifica del file function.php</h1>
<p>&nbsp;</p>
<p>Nel file <em>function.php</em> aggiungiamo:</p>
<p>&nbsp;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
* Capture the first image from the post.
* @global object $post
* @global object $posts
* @return string
*/</span>
<span style="color: #000000; font-weight: bold;">function</span> theme_function_capture_first_image<span style="color: #009900;">&#40;</span><span style="color: #000088;">$p</span><span style="color: #339933;">=</span><span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$firstImg</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$p</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$post</span><span style="color: #339933;">,</span> <span style="color: #000088;">$posts</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$firstImg</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
<span style="color: #990000;">ob_start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #990000;">ob_end_clean</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$output</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_match_all</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'//i'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>post_content<span style="color: #339933;">,</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$firstImg</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$output</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_match_all</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'//i'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$p</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>post_content<span style="color: #339933;">,</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$firstImg</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$firstImg</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// ritorna una immagine associata al post: thumb, prima immagine del post, default</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> return_post_image<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">,</span><span style="color: #000088;">$dim</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$imgpath</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dim</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$dim</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">60</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">60</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$imgpath</span><span style="color: #339933;">=</span>get_the_post_thumbnail<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dim</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$imgpath</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$imgpath</span> <span style="color: #339933;">=</span> theme_function_capture_first_image<span style="color: #009900;">&#40;</span>get_post<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$imgpath</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$imgpath</span> <span style="color: #339933;">=</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'template_directory'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/images/default_pp.gif'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$imgpath</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;img src=&quot;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$imgpath</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot; alt=&quot;'</span><span style="color: #339933;">.</span> <span style="color: #000088;">$title</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; /&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$imgpath</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>&nbsp;</p>
<p>N.B.: Di default la dimensione dell&#8217;imamgine è di 60&#215;60. Nel caso in cui noi volessimo una immagine di dimensione diversa, per esempio 32&#215;32, basta modificare la chiamata alla funzione nel file <em>wppp.php</em> in questo modo:</p>
<p>&nbsp;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">replace<span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'%post_thumb%'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span>return_post_image<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'post_id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">32</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">32</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>&nbsp;</p>
<p>Un&#8217;altra modifica, in futuro, potrebbe essere fare in modo di passare la dimensione dei thumbs nel momento in cui viene richiamato il plugin.</p>
<p>&nbsp;</p>
<p>A questo punto quando richiamiamo il plugin avremo a possibilità di inserire il tag %post_thumb% che ci darà l&#8217;&lt;img&gt; riferita all&#8217;immagine associata al post.</p>
<p>&nbsp;</p>
<h1>3) il CSS per lo stile</h1>
<p>&nbsp;</p>
<p>Concludiamo con il css per lo stile dell&#8217;elenco dei post, che nel mio caso è:</p>
<p>&nbsp;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/*Popular Posts*/</span>
&nbsp;
ul<span style="color: #6666ff;">.wppp_list</span> li <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">min-height</span><span style="color: #00AA00;">:</span><span style="color: #933;">65px</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">list-style</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span> <span style="color: #993333;">outside</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
ul<span style="color: #6666ff;">.wppp_list</span> img <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">margin-right</span><span style="color: #00AA00;">:</span><span style="color: #933;">4px</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span><span style="color: #933;">2px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#ECEFF5</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>&nbsp;</p>
<p>Ed ecco il risultato finale:<br />
<a href="http://www.roccoagostino.eu/wp/wp-content/uploads/2011/10/ppp.png"><img class="aligncenter size-full wp-image-831" title="ppp" src="http://www.roccoagostino.eu/wp/wp-content/uploads/2011/10/ppp.png" alt="" width="378" height="473" /></a></p>
<p>&nbsp;</p>
<p><strong>Enjoy it!</strong></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roccoagostino.eu/2011/10/23/thumbnails-per-wordpress-com-popular-posts/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Modificare il tema di WordPress (parte 3): personalizzare l&#8217;intestazione e lo sfondo</title>
		<link>http://blog.roccoagostino.eu/2011/10/17/modificare-il-tema-di-wordpress-parte-3-personalizzare-lintestazione-e-lo-sfondo/</link>
		<comments>http://blog.roccoagostino.eu/2011/10/17/modificare-il-tema-di-wordpress-parte-3-personalizzare-lintestazione-e-lo-sfondo/#comments</comments>
		<pubDate>Mon, 17 Oct 2011 17:16:26 +0000</pubDate>
		<dc:creator>Rocky</dc:creator>
				<category><![CDATA[Informatica]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[funzioni]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[programmazione]]></category>
		<category><![CDATA[sfondo]]></category>
		<category><![CDATA[testata]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[web 2.0]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://blog.roccoagostino.eu/?p=760</guid>
		<description><![CDATA[<img src="http://www.roccoagostino.eu/wp/wp-content/uploads/wordpress_ico.jpg" width="33" height="33" alt="" title="WordPress" /><br/>Aggiornando la piattaforma alla versione 3.x di Wordpress, il tema che avete installato precedentemente sicuramente non conterrà le nuove funzioni di personalizzazione dell'intestazione e dello sfondo del blog. Grazie a semplici modifiche ai files del tema è possibile inserire, lato pannello di amministrazione, queste funzioni in modo da modificare l'aspetto del blog senza dover agire sul codice del tema stesso.]]></description>
			<content:encoded><![CDATA[<img src="http://www.roccoagostino.eu/wp/wp-content/uploads/wordpress_ico.jpg" width="33" height="33" alt="" title="WordPress" /><br/><p>Aggiornando la piattaforma alla versione 3.x di WordPress, il tema che avete installato precedentemente sicuramente non conterrà le nuove funzioni di personalizzazione dell&#8217;intestazione e dello sfondo del blog. Grazie a semplici modifiche ai files del tema è possibile inserire, lato pannello di amministrazione, queste funzioni in modo da modificare l&#8217;aspetto del blog senza dover agire sul codice del tema stesso.</p>
<p><span id="more-760"></span></p>
<p>&nbsp;</p>
<h1>la Testata</h1>
<p>Tra le novità di WordPress 3.x vi è il pannello per la personalizzazione delle intestazioni. E&#8217; possibile accedere alle intestazioni personalizzate abilitando la voce nel pannello di amministrazione di WordPress 3.x anche se il vostro tema non lo supporta nativamente.<br />
Per fare ciò basta inserire nel file <em>function.php</em> le seguenti linee di codice:</p>
<p>&nbsp;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">define( 'HEADER_IMAGE', '%s/images/logo.jpj' ); //logo di defaul
define( 'HEADER_IMAGE_WIDTH', apply_filters( '', 948 ) ); // Larghezza del logo
define( 'HEADER_IMAGE_HEIGHT', apply_filters( '', 180 ) ); // Altezza del logo
define( 'NO_HEADER_TEXT', true );
add_custom_image_header( '', 'admin_header_style' ); // Abilita la voce nel pannello di controllo 
&nbsp;
// Foglio di stile per il pannello amministratore
if ( ! function_exists( 'admin_header_style' ) ) :
function admin_header_style() {
?&gt;
&lt;style type=&quot;text/css&quot;&gt;
#headimg {
height: <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> HEADER_IMAGE_HEIGHT<span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>px;
width: <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> HEADER_IMAGE_WIDTH<span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>px;
}
#headimg h1, #headimg #desc {
display: none;
}
&lt;/style&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>&nbsp;</p>
<p>Nel pannelo di controllo nel menu &#8220;aspetto&#8221; comparirà la voce &#8220;Testata&#8221;.</p>
<p>&nbsp;</p>
<p style="text-align: center;"><a href="http://www.roccoagostino.eu/wp/wp-content/uploads/2011/10/aspetto_testa.jpg"><img class="aligncenter size-full wp-image-761" style="border-width: 1px; border-color: black; border-style: solid;" title="aspetto_testa" src="http://www.roccoagostino.eu/wp/wp-content/uploads/2011/10/aspetto_testa.jpg" alt="" width="166" height="168" /></a></p>
<p>&nbsp;</p>
<p>Selezionandola, comparirà la nuova pagina di amministrazione per la scelta delle immagini da inserire nell&#8217;header del blog.<br />
Una volta caricate le immagini possiamo anche decidere di visualizzarle in maniera random.</p>
<p>&nbsp;</p>
<p style="text-align: center;"><a href="http://www.roccoagostino.eu/wp/wp-content/uploads/2011/10/testata_personalizzazione.jpg"><img class="aligncenter size-full wp-image-764" style="border-width: 1px; border-color: black; border-style: solid;" title="testata_personalizzazione" src="http://www.roccoagostino.eu/wp/wp-content/uploads/2011/10/testata_personalizzazione.jpg" alt="" width="540" height="568" /></a></p>
<p>&nbsp;</p>
<p>Nel <em>header.php</em> basta inserire la seguente linea di codice:</p>
<p>&nbsp;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">&lt;img src=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> header_image<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; width=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> HEADER_IMAGE_WIDTH<span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; height=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> HEADER_IMAGE_HEIGHT<span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; alt=&quot;&quot; /&gt;</pre></td></tr></table></div>

<p>o anche</p>
<p>&nbsp;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">&lt;div id=&quot;header-container&quot; style=&quot;background: url('<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> header_image<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>');&quot;&gt;</pre></td></tr></table></div>

<p>&nbsp;</p>
<h1>lo Sfondo</h1>
<p>Altra modifica possibile per utilizzare le nuove funzioni di WordPress 3.x è la possibilità di personalizza lo sfondo</p>
<p>&nbsp;</p>
<p>Aggiungendo nel file <em>function.php</em> la linea di codice:</p>
<p>&nbsp;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">add_custom_background<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p style="text-align: center;">nel pannello di amministrazione comparirà la voce &#8220;Sfondo&#8221; nel menù &#8220;Aspetto&#8221;:<br />
<a href="http://www.roccoagostino.eu/wp/wp-content/uploads/2011/10/aspetto_sfondo.jpg"><img class="aligncenter size-full wp-image-780" style="border-width: 1px; border-color: black; border-style: solid;" title="aspetto_sfondo" src="http://www.roccoagostino.eu/wp/wp-content/uploads/2011/10/aspetto_sfondo.jpg" alt="" width="166" height="168" /></a><br />
Selezionandola, comparirà la nuova pagina di amministrazione per la scelta dello sfondo da inserire nel blog.</p>
<p>&nbsp;</p>
<p style="text-align: center;"><a href="http://www.roccoagostino.eu/wp/wp-content/uploads/2011/10/sfondo_personalizzazione.jpg"><img class="aligncenter size-full wp-image-767" style="border-width: 1px; border-color: black; border-style: solid;" title="sfondo_personalizzazione" src="http://www.roccoagostino.eu/wp/wp-content/uploads/2011/10/sfondo_personalizzazione.jpg" alt="" width="540" height="662" /></a></p>
<p>&nbsp;</p>
<p><strong>Enjoy it and.. see you soon!</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roccoagostino.eu/2011/10/17/modificare-il-tema-di-wordpress-parte-3-personalizzare-lintestazione-e-lo-sfondo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Modificare il tema di WordPress (parte 2): menù di navigazione</title>
		<link>http://blog.roccoagostino.eu/2011/10/08/modificare-il-tema-di-wordpress-parte-2-menu-di-navigazione/</link>
		<comments>http://blog.roccoagostino.eu/2011/10/08/modificare-il-tema-di-wordpress-parte-2-menu-di-navigazione/#comments</comments>
		<pubDate>Sat, 08 Oct 2011 21:04:17 +0000</pubDate>
		<dc:creator>Rocky</dc:creator>
				<category><![CDATA[Informatica]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[funzioni]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[programmazione]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[web 2.0]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://blog.roccoagostino.eu/?p=669</guid>
		<description><![CDATA[<img src="http://www.roccoagostino.eu/wp/wp-content/uploads/wordpress_ico.jpg" width="33" height="33" alt="" title="WordPress" /><br/>Modificare il tema di Wordpress per poter utilizzare il menù di navigazione.]]></description>
			<content:encoded><![CDATA[<img src="http://www.roccoagostino.eu/wp/wp-content/uploads/wordpress_ico.jpg" width="33" height="33" alt="" title="WordPress" /><br/><p>WordPress include un meccanismo semplice per introdurre dei menù di navigazione personalizzati nel proprio tema. Per incorporare nel tema il supporto al menù, è necessario aggiungere poche righe di codice. Innanzitutto nel file <em>functions.php</em> del tema, si deve scrivere una funzione per registrare il nome dei menù che si vogliono creare. Il nome sarà quello che comparirà nella pagina del pannello di amministrazione di WordPress alla pagina Aspetto-&gt;Menu.<br />
<span id="more-669"></span><br />
Per esempio, tramite questo codice, nel box “Posizione dei temi” comparirà la posizione “Menu Intestazione”:</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> register_my_menus<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  register_nav_menus<span style="color: #009900;">&#40;</span>
    <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'menu-intestazione'</span> <span style="color: #339933;">=&gt;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Menu Intestazione'</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>questo codice, invece, farà comparire due nuove posizioni:</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> register_my_menus<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
register_nav_menus<span style="color: #009900;">&#40;</span>
  <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
    <span style="color: #0000ff;">'menu-intestazione'</span> <span style="color: #339933;">=&gt;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Menu Intestazione'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'menu-extra'</span> <span style="color: #339933;">=&gt;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Menu Extra'</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Per assicurarsi che il tema attivi l’opzione dei menù personalizzati, è necessario aggiungere anche questa riga che comunica al tema di eseguire la funzione “<em>register_my_menus</em>”:</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">add_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'init'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'register_my_menus'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>A questo punto resta da inserire nel tema la posizione in cui vogliamo che il menù (o i vari menù) siano visualizzati. Per far questo si deve aprire nell’editor il file del template corrispondente alla posizione desiderata e inserire una chiamata alla funzione <em>wp_nav_menu()</em> per ciascuna posizione. Per esempio, si vuole posizionare il menu “Menu Intestazione”, precedentemente registrato nel file <em>header.php</em>, in modo che compaia nella testata del tema. Il codice da inserire è il seguente:</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_nav_menu<span style="color: #009900;">&#40;</span>  <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'theme_location'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'menu-intestazione'</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p><strong>IMPORTANTE: il nome associato a theme_location deve essere lo stesso inserito in <em>functions.php</em>.</strong></p>
<p>&nbsp;</p>
<p>Questa funzione crea una lista del tipo</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;ul&gt; 
  &lt;li&gt;&lt;/li&gt;
  &lt;li&gt;&lt;/li&gt;
&lt;/ul&gt;</pre></div></div>

<p>Se si aggiunge alla funzione <em>wp_nav_menu()</em> il parametro “<em>container_class</em>”, si può specificare la classe associata al menù:</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_nav_menu<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'theme_location'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'menu-intestazione'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'container_class'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'classe_menu_intestazione'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>In questo modo si può personalizzare la grafica del menù specificando nel CSS gli attributi della classe “classe_menu_intestazione”.</p>
<p>Oppure, come nel mio caso, se già esiste nel foglio di stile una classe per i menù tradizionali, basta sostituire il codice all&#8217;interno, per esempio, del</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;div id=”menu”&gt;......&lt;/div&gt;</pre></div></div>

<p>richiamando la funzione</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_nav_menu<span style="color: #009900;">&#40;</span>  <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'theme_location'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'menu-intestazione'</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Enjoy it and.. see you soon!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roccoagostino.eu/2011/10/08/modificare-il-tema-di-wordpress-parte-2-menu-di-navigazione/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Modificare il tema di WordPress (parte 1): la funzione post thumbnail</title>
		<link>http://blog.roccoagostino.eu/2011/10/06/modificare-il-tema-di-wordpress-parte-1-la-funzione-post-thumbnail/</link>
		<comments>http://blog.roccoagostino.eu/2011/10/06/modificare-il-tema-di-wordpress-parte-1-la-funzione-post-thumbnail/#comments</comments>
		<pubDate>Thu, 06 Oct 2011 18:34:49 +0000</pubDate>
		<dc:creator>Rocky</dc:creator>
				<category><![CDATA[Informatica]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[funzioni]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[programmazione]]></category>
		<category><![CDATA[thumbnail]]></category>
		<category><![CDATA[web 2.0]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://blog.roccoagostino.eu/?p=625</guid>
		<description><![CDATA[<img src="http://www.roccoagostino.eu/wp/wp-content/uploads/wordpress_ico.jpg" width="33" height="33" alt="" title="WordPress" /><br/>Come inserire nel proprio tema funzione post thumbnail (miniature) per associare una immagine agli articoli.]]></description>
			<content:encoded><![CDATA[<img src="http://www.roccoagostino.eu/wp/wp-content/uploads/wordpress_ico.jpg" width="33" height="33" alt="" title="WordPress" /><br/><p>Ormai del mio tema per wordpress, che ho scaricato tra quelli gratuiti nel lontano 2009, ci sta ben poco. Nel corso dei mesi tante sono state le modifiche: supporto ai plugin, ai widget, agli script in JQuery, modifiche in php che adesso ad elencarli tutti ho davvero tanta difficoltà. Wordpress si aggiorna, introduce nuove funzioni e nuove possibilità di fare blogging, ma il mio tema &#8220;no, non lo voglio cambiare!&#8221;.</p>
<p><span id="more-625"></span></p>
<p>Così, armato di santa pazienza, googlando un pò in giro, ecco che mi ritrovo per l&#8217;ennesima volta a far modifiche.</p>
<p>&nbsp;</p>
<p>Vediamo la prima: la funzione post thumbnail (miniature).</p>
<p>&nbsp;</p>
<p>Le icone che vedere associate agli articoli di questo blog sono in realtà associate alle categorie (uso il plugin <a href="http://blog.roccoagostino.eu/2009/08/30/associa-le-icone-alle-categorie-del-blog-wordpresscategory-icons-plugin/" target="_blank">Category Icons</a>). Pertanto esse non sono direttamente legate al contenuto dell&#8217;articolo. Stanco della visualizzazione testuale a lista dei post correlati ho installato il plugin <a href="http://wordpress.org/extend/plugins/related-posts-thumbnails/" target="_blank">Related Posts Thumbnails</a> che crea un riquadro per ogni articolo correlato inserendo una immagine contenuta nell&#8217;articolo stesso. Problema: e se nel contenuto non vi sono inserite delle immagini? Il plugin usa la minitura associata all&#8217;articolo!</p>
<p>&nbsp;</p>
<p>Per attivare la gestione lato backend della “miniatura articolo” è sufficiente editare il file <em>functions.php</em> e inserire le seguenti linee di codice che, nell&#8217;ottica di compatibilità e stabilità, sono:</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'add_theme_support'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    add_theme_support<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'post-thumbnails'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>&nbsp;</p>
<p>Fatto questo, entrando nell’amministrazione e andando nella modifica di un post, troveremo sulla sidebar destra un nuovo pannello:</p>
<p>&nbsp;</p>
<p><center><img class="aligncenter size-full wp-image-617" title="thumbs" src="http://www.roccoagostino.eu/wp/wp-content/uploads/2011/10/thumbs.jpg" alt="" width="295" height="76" /></center>Da qui possiamo associare una immagine all&#8217;articolo.</p>
<p>&nbsp;</p>
<p>Con</p>
<p>&nbsp;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;!--</span>?php get_post_thumbnail<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>?<span style="color: #339933;">--&gt;</span></pre></td></tr></table></div>

<p>&nbsp;</p>
<p>recuperiamo l’url della nostra thumbnail e possiamo tranquillamente inserirlo nel loop in questo modo ad esempio:</p>
<p>&nbsp;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">&lt;div&gt;&lt;img src=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> get_post_thumbnail<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; alt=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; /&gt;&lt;/div&gt;</pre></td></tr></table></div>

<p>&nbsp;</p>
<p>Enjoy it and.. see you soon!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roccoagostino.eu/2011/10/06/modificare-il-tema-di-wordpress-parte-1-la-funzione-post-thumbnail/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Feed RSS&#8230; questo sconosciuto!</title>
		<link>http://blog.roccoagostino.eu/2009/08/24/feed-rss-questo-sconosciuto/</link>
		<comments>http://blog.roccoagostino.eu/2009/08/24/feed-rss-questo-sconosciuto/#comments</comments>
		<pubDate>Mon, 24 Aug 2009 05:20:53 +0000</pubDate>
		<dc:creator>Rocky</dc:creator>
				<category><![CDATA[Informatica]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[feed rss]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[web 2.0]]></category>

		<guid isPermaLink="false">http://blog.roccoagostino.eu/?p=103</guid>
		<description><![CDATA[<img src="http://www.roccoagostino.eu/wp/wp-content/uploads/internet_ico.JPG" width="32" height="32" alt="" title="Internet" /><br/>Di cosa stiamo parlando? RSS esattamente significa Really Simple Syndication o Rich Site Summary e non è altro che una serie di formati espressi in Xml, che dalla forma più semplice, contengono una lista (i cosiddetti feed) di titoli, brevi sommari e link. L&#8217;RSS è stato &#8220;inventato&#8221; originariamente da Netscape alla fine degli anni &#8217;90, [...]]]></description>
			<content:encoded><![CDATA[<img src="http://www.roccoagostino.eu/wp/wp-content/uploads/internet_ico.JPG" width="32" height="32" alt="" title="Internet" /><br/><h4 style="text-align: justify;">Di cosa stiamo parlando?</h4>
<p style="text-align: justify;">RSS esattamente significa <em>Really Simple Syndication o Rich Site Summary </em>e non è altro che una serie di formati espressi in Xml, che dalla forma più semplice, contengono una lista (i cosiddetti <strong>feed</strong>) di titoli, brevi sommari e link. L&#8217;RSS è stato &#8220;inventato&#8221; originariamente da <strong>Netscape</strong> alla fine degli anni &#8217;90, al fine di creare uno standard per la condivisione di notizie e news provenienti da altri portali. Rimaneggiato nel tempo, oggi trova spazio e grande uso nel mondo dei Blogger.</p>
<p><span id="more-103"></span><br />
I feed RSS rappresentano un alleato prezioso per coloro che desiderano tenersi costantemente aggiornati, raccogliendo informazioni da diversi siti. Se, ad esempio, ci si collega spesso a siti che pubblicano notizie di attualità, con i feed RSS si possono raccogliere rapidamente, in un&#8217;unica &#8220;finestra&#8221;, tutte le notizie più recenti. Queste appaiono normalmente in forma breve, con un titolo e poche righe di testo. Per approfondire, si può cliccare sul collegamento ipertestuale (&#8220;link&#8221;) che rinvia alla pagina con il testo completo.</p>
<h4 style="text-align: justify;">Quali sono i vantaggi per l&#8217;utente?</h4>
<p style="text-align: justify;">Attraverso i programmi Newsreader l’utente può navigare tra i siti Web di interesse in modo diverso rispetto a quanto avviene con un normale browser:</p>
<ul style="text-align: justify;">
<li>L’utente non deve accedere ai diversi siti di interesse per vedere se vi sono delle nuove notizie. Questo tipo di attività viene svolta dal Newsreader, che segnala le varie novità e propone all’utente i contenuti aggiornati.</li>
<li>Non è necessario aprire ogni pagina di un sito per capire se il contenuto sia interessante. Sulla base del titolo e del sottotitolo l’utente può valutare se la notizia contenga informazioni che lo interessano e solo in caso affermativo accedere alla pagina Web vera e propria. In questo modo si risparmia molto tempo nella navigazione.</li>
<li>A differenza delle tradizionali Newsletter, l’utente non è più obbligato ad abbonarsi al servizio lasciando il proprio indirizzo di posta elettronica, riducendo così i rischi di recapito di posta indesiderata (spam);</li>
<li>Ormai tutte le principali testate giornalistiche internazionali, dal New York Times allo Spiegel, dalla Reuters alla BBC mettono a disposizione degli utenti gratuitamente le ultime notizie come RSS – Feeds.</li>
<li style="text-align: justify;">Gli RSS-Feeds sono messi a disposizione della collettività e possono essere caricati all’interno di qualunque sito. In questo modo viene facilitata sensibilmente la diffusione delle notizie nel Web.</li>
</ul>
<h4 style="text-align: justify;">Come utilizzare i Feed RSS?</h4>
<p style="text-align: justify;">Per utilizzare i feed RSS è necessario:</p>
<ul style="text-align: justify;">
<li>che il sito di proprio interesse pubblichi le novità in formato RSS (spesso la presenza di RSS viene segnalata da un simbolo come quello pubblicato in questa pagina);</li>
<li>un &#8220;aggregatore&#8221; di RSS. Quest&#8217;ultimo può essere un software che va installato nel proprio personal computer oppure una applicazione condivisa in Rete. Va segnalato che le versioni più recenti dei browser (cioè il software che si utilizza normalmente per navigare in Rete, come <a title="Il link apre in una nuova finestra" href="http://www.microsoft.com/italy/windows/ie/default.mspx">Internet Explorer</a> e <a title="Il link apre in una nuova finestra" href="http://www.mozilla-europe.org/it/products/firefox/">Firefox</a>, <a title="Il link apre in una nuova finestra" href="http://www.opera.com/">Opera</a>, <a title="Il link apre in una nuova finestra" href="http://www.apple.com/it/macosx/features/safari/">Safari</a>) hanno integrato gli aggregatori al proprio interno</li>
</ul>
<p style="text-align: justify;">Il video seguente spiega chiaramente come utilizzare gli aggregatori di RSS on line.</p>
<p style="text-align: center;"><iframe title="YouTube video player" class="youtube-player" type="text/html" width="425" height="344" src="http://www.youtube.com/embed/nJZVJoTSDyw" frameborder="0" allowFullScreen="true"> </iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.roccoagostino.eu/2009/08/24/feed-rss-questo-sconosciuto/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  blog.roccoagostino.eu/tag/blog/feed/ ) in 2.71417 seconds, on Feb 6th, 2012 at 11:43 am UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 13th, 2012 at 11:43 am UTC -->
