Return to Snippet

Revision: 47722
at June 15, 2011 04:01 by serialk89


Initial Code
<?php
                //consulta todos los empleados
                $sql = mysql_query("SELECT DISTINCT post_name,post_title,post_excerpt
                FROM wp_o0qb3z_posts, wp_o0qb3z_term_relationships, wp_o0qb3z_term_taxonomy
                WHERE wp_o0qb3z_term_relationships.object_id = wp_o0qb3z_posts.id
                AND post_status = 'publish'
                AND post_type = 'post'
                AND wp_o0qb3z_term_taxonomy.term_taxonomy_id = wp_o0qb3z_term_relationships.term_taxonomy_id
                AND wp_o0qb3z_term_taxonomy.taxonomy = 'category'
                AND wp_o0qb3z_term_taxonomy.term_id = 'EL ID DE LA CATEGORIA'
                ORDER BY post_date DESC
                LIMIT 10 ",$link);

                while($row = mysql_fetch_array($sql)){ 

                    echo '<div>'.$row['post_title'].'</div><br />';

                } 
            ?>

Initial URL

                                

Initial Description
Selecciono los post por categoría desde la base de datos de wordpress

Initial Title
SELECCIONAR POST POR CATEGORIA SIN WORDPRESS Y MYSQL

Initial Tags
mysql, php, wordpress

Initial Language
PHP