<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Estrarre posts di una categoria wordpress]]></title><description><![CDATA[<p dir="auto">finalmente sono riuscito a strutturare l'home page di wordpress a sezioni.<br />
ora ho incontrato un piccolo problema.....<br />
sto cercando di richiamare i post di determinate categorie in ciascuna delle sezioni con questo codice</p>
<pre><code>[FONT=Courier New]&lt;?php query_posts('cat=1&amp;showposts=2'); ?&gt;[/FONT]
[FONT=Verdana]&lt;?php if (have_posts()) : ?&gt;[/FONT]
[FONT=Verdana]&lt;?php while (have_posts()) : the_post(); ?&gt;[/FONT]
</code></pre>
<p dir="auto">funziona, ma se provo a replicare la query mi dà errore.<br />
soluzione?</p>
]]></description><link>https://dev.connect.gt/topic/43231/estrarre-posts-di-una-categoria-wordpress</link><generator>RSS for Node</generator><lastBuildDate>Thu, 26 Nov 2026 09:50:30 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/43231.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 10 Aug 2007 14:21:09 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Estrarre posts di una categoria wordpress on Mon, 13 Aug 2007 08:28:09 GMT]]></title><description><![CDATA[<p dir="auto">in effetti avevo pensato anch'io potesse dipendere da quanto dici.<br />
il problema è che la mia conoscenza di php-mysql è pari a zero e non so cosa devo inserire per chiudere la connessione al db di phpbb e riaprire quella al db di wordpress.</p>
]]></description><link>https://dev.connect.gt/post/580505</link><guid isPermaLink="true">https://dev.connect.gt/post/580505</guid><dc:creator><![CDATA[stef84]]></dc:creator><pubDate>Mon, 13 Aug 2007 08:28:09 GMT</pubDate></item><item><title><![CDATA[Reply to Estrarre posts di una categoria wordpress on Mon, 13 Aug 2007 01:28:24 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto"><strong>stef84</strong></p>
<p dir="auto">perfetto funziona, grazie!</p>
<p dir="auto">ora ho un altro problema.....<br />
se provo ad estrarre gli ultimi topic dal forum con il codice qui sotto (che utilizzo da tempo e funziona benissimo)</p>
<pre><code>&lt;? 
$ris_query = "SELECT topic_poster, topic_id, topic_title, username FROM phpbb_topics INNER JOIN phpbb_users ON topic_poster = user_id WHERE forum_id!=10 AND forum_id!=9 AND forum_id!=8 ORDER BY topic_time DESC LIMIT 10"; 
$db = mysql_connect("xx.xxx.xxx.xx","Sqlxxxxx","xxxxxxxx"); 
$res = mysql_db_query("Sqlxxxxx_x",$ris_query) or die('errore'); 
$num_righe = mysql_num_rows($res); 
?&gt; 
&lt;? if($num_righe &gt; 0) { ?&gt; 
&lt;table border="0" cellpadding="0" cellspacing="0"&gt; 
&lt;? 
$i = 0; 
while($i &lt; $num_righe) { 
$topic_id = mysql_result($res,$i,"topic_id"); 
$topic_title = mysql_result($res,$i,"topic_title"); 
if (strlen($topic_title)&gt;43) 
  $topic_title = substr($topic_title,0,40) . '...'; 
$username = mysql_result($res,$i,"username"); 
$topic_poster = mysql_result($res,$i,"topic_poster"); 
echo "&lt;tr&gt;"; 
echo "&lt;td&gt;&lt;a href=\"[URL="http://www.miosito.com/community/viewtopic.php?t=$topic_id%5C"]http://www.miosito.com/community/viewtopic.php?t=$topic_id\[/URL]" target=\"_blank\" title=\"$topic_title\" class='topic_title'&gt;$topic_title&lt;/td&gt;"; 
echo "&lt;/tr&gt;"; 
echo "&lt;tr&gt;"; 
echo "&lt;td&gt;postato da: &lt;a href=\"[URL="http://www.miosito.com/community/profile.php?mode=viewprofile&amp;u=$topic_poster%5C"]http://www.miosito.com/community/profile.php?mode=viewprofile&amp;u=$topic_poster\[/URL]" target=\"_blank\" title=\"$username\" class='topic_poster'&gt;$username&lt;/td&gt;"; 
echo "&lt;/tr&gt;"; 
echo "&lt;tr&gt;"; 
echo "&lt;td&gt;&amp;nbsp;&lt;/td&gt;"; 
echo "&lt;/tr&gt;"; 
$i++; 
} 
?&gt; 
&lt;/table&gt; 
&lt;? } else echo "Nessun topic presente"; ?&gt;
</code></pre>
<p dir="auto">in ciascuna tabella dove estraggo i posts di wordpress mi dà questo errore</p>
<pre><code>[B]WordPress database error:[/B] [Table 'Sqlxxxxx_x.wp_posts' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts LEFT JOIN wp_post2cat ON (wp_posts.ID = wp_post2cat.post_id) WHERE 1=1 AND wp_post2cat.category_id IN (4) AND (post_type = 'post' AND (post_status = 'publish')) GROUP BY wp_posts.ID ORDER BY post_date DESC LIMIT 0, 1
</code></pre>
</blockquote>
<p dir="auto">Credo dipenda dal fatto che ti connetti ad un altro DB</p>
<pre><code class="language-php"> $db = mysql_connect("xx.xxx.xxx.xx","Sqlxxxxx","xxxxxxxx");
</code></pre>
<p dir="auto">Per poi ritornare ad eseguire query ma sul db di phpBB.<br />
Prova a chiudere la connessionedel db di phpbb e riaprire quella del db di wordpress.</p>
]]></description><link>https://dev.connect.gt/post/580489</link><guid isPermaLink="true">https://dev.connect.gt/post/580489</guid><dc:creator><![CDATA[ayrton2001]]></dc:creator><pubDate>Mon, 13 Aug 2007 01:28:24 GMT</pubDate></item><item><title><![CDATA[Reply to Estrarre posts di una categoria wordpress on Sun, 12 Aug 2007 09:27:27 GMT]]></title><description><![CDATA[<p dir="auto">perfetto funziona, grazie!</p>
<p dir="auto">ora ho un altro problema.....<br />
se provo ad estrarre gli ultimi topic dal forum con il codice qui sotto (che utilizzo da tempo e funziona benissimo)</p>
<pre><code>&lt;? 
$ris_query = "SELECT topic_poster, topic_id, topic_title, username FROM phpbb_topics INNER JOIN phpbb_users ON topic_poster = user_id WHERE forum_id!=10 AND forum_id!=9 AND forum_id!=8 ORDER BY topic_time DESC LIMIT 10"; 
$db = mysql_connect("xx.xxx.xxx.xx","Sqlxxxxx","xxxxxxxx"); 
$res = mysql_db_query("Sqlxxxxx_x",$ris_query) or die('errore'); 
$num_righe = mysql_num_rows($res); 
?&gt; 
&lt;? if($num_righe &gt; 0) { ?&gt; 
&lt;table border="0" cellpadding="0" cellspacing="0"&gt; 
&lt;? 
$i = 0; 
while($i &lt; $num_righe) { 
$topic_id = mysql_result($res,$i,"topic_id"); 
$topic_title = mysql_result($res,$i,"topic_title"); 
if (strlen($topic_title)&gt;43) 
  $topic_title = substr($topic_title,0,40) . '...'; 
$username = mysql_result($res,$i,"username"); 
$topic_poster = mysql_result($res,$i,"topic_poster"); 
echo "&lt;tr&gt;"; 
echo "&lt;td&gt;&lt;a href=\"[URL]http://www.miosito.com/community/viewtopic.php?t=$topic_id\[/URL]" target=\"_blank\" title=\"$topic_title\" class='topic_title'&gt;$topic_title&lt;/td&gt;"; 
echo "&lt;/tr&gt;"; 
echo "&lt;tr&gt;"; 
echo "&lt;td&gt;postato da: &lt;a href=\"[URL]http://www.miosito.com/community/profile.php?mode=viewprofile&amp;u=$topic_poster\[/URL]" target=\"_blank\" title=\"$username\" class='topic_poster'&gt;$username&lt;/td&gt;"; 
echo "&lt;/tr&gt;"; 
echo "&lt;tr&gt;"; 
echo "&lt;td&gt;&amp;nbsp;&lt;/td&gt;"; 
echo "&lt;/tr&gt;"; 
$i++; 
} 
?&gt; 
&lt;/table&gt; 
&lt;? } else echo "Nessun topic presente"; ?&gt;
</code></pre>
<p dir="auto">in ciascuna tabella dove estraggo i posts di wordpress mi dà questo errore</p>
<pre><code>[B]WordPress database error:[/B] [Table 'Sqlxxxxx_x.wp_posts' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts LEFT JOIN wp_post2cat ON (wp_posts.ID = wp_post2cat.post_id) WHERE 1=1 AND wp_post2cat.category_id IN (4) AND (post_type = 'post' AND (post_status = 'publish')) GROUP BY wp_posts.ID ORDER BY post_date DESC LIMIT 0, 1
</code></pre>
]]></description><link>https://dev.connect.gt/post/580504</link><guid isPermaLink="true">https://dev.connect.gt/post/580504</guid><dc:creator><![CDATA[stef84]]></dc:creator><pubDate>Sun, 12 Aug 2007 09:27:27 GMT</pubDate></item><item><title><![CDATA[Reply to Estrarre posts di una categoria wordpress on Sat, 11 Aug 2007 15:05:03 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto"><strong>stef84</strong></p>
<p dir="auto">questo errore:</p>
<p dir="auto"><strong>Parse error</strong>: syntax error, unexpected $end in <strong>/web/htdocs/www.miosito.com/home/wordpress/wp-content/themes/miotema/index.php</strong> on line <strong>176</strong></p>
</blockquote>
<p dir="auto">Credo che devi chiudere i blocchi if e while</p>
<pre><code class="language-php">&lt;?php query_posts('cat=1&amp;showposts=2'); ?&gt;
&lt;?php if (have_posts()) : ?&gt;
&lt;?php while (have_posts()) : the_post(); ?&gt;

//... tuo codice...

&lt;?php endwhile; ?&gt;
&lt;?php endif; ?&gt;
</code></pre>
]]></description><link>https://dev.connect.gt/post/580490</link><guid isPermaLink="true">https://dev.connect.gt/post/580490</guid><dc:creator><![CDATA[ayrton2001]]></dc:creator><pubDate>Sat, 11 Aug 2007 15:05:03 GMT</pubDate></item><item><title><![CDATA[Reply to Estrarre posts di una categoria wordpress on Fri, 10 Aug 2007 19:51:00 GMT]]></title><description><![CDATA[<p dir="auto">questo errore:</p>
<p dir="auto"><strong>Parse error</strong>: syntax error, unexpected $end in <strong>/web/htdocs/www.miosito.com/home/wordpress/wp-content/themes/miotema/index.php</strong> on line <strong>176</strong></p>
]]></description><link>https://dev.connect.gt/post/580509</link><guid isPermaLink="true">https://dev.connect.gt/post/580509</guid><dc:creator><![CDATA[stef84]]></dc:creator><pubDate>Fri, 10 Aug 2007 19:51:00 GMT</pubDate></item><item><title><![CDATA[Reply to Estrarre posts di una categoria wordpress on Fri, 10 Aug 2007 14:43:23 GMT]]></title><description><![CDATA[<p dir="auto">Che errore?</p>
]]></description><link>https://dev.connect.gt/post/580491</link><guid isPermaLink="true">https://dev.connect.gt/post/580491</guid><dc:creator><![CDATA[ayrton2001]]></dc:creator><pubDate>Fri, 10 Aug 2007 14:43:23 GMT</pubDate></item></channel></rss>