d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Wordpress Query Question :(
Add Reply New Topic New Poll
Member
Posts: 9,318
Joined: Mar 17 2007
Gold: 2.20
Dec 18 2013 11:41am
I have done a category called Home-Box.
In this category i have create 3 article: ONE , TWO, THREE.

NOW.....in my homepage.php how can I recall the articles?

<?php
query_posts( array ( 'category_name' => 'home-box', 'posts_per_page' => 3 ) );
query_posts( 'posts_per_page=3' );

// the Loop
if(have_posts()): while ( have_posts() ) : the_post();
echo '<li>';
the_title();
the_content();
echo '</li>';
endwhile;endif;

// Reset Query
wp_reset_query();
?>

where is wrong my code? :|
It's work...BUT if i remove one article from category and i recall the query, the browser show me again the article removed :(


I GIVE U HEARTSTONE CD KEY EU IF U CAN RESOLVE ME THIS PROBLEM!


This post was edited by nonNo on Dec 18 2013 11:55am
Member
Posts: 2
Joined: Dec 18 2013
Gold: 0.00
Dec 18 2013 01:29pm
How are you referencing the articles (ONE,TWO,etc)? I don't see any code where the articles are referenced. Also, how are you querying the database? If you are requesting all posts, then how do you restrict which posts will display? We need to see that code.
Member
Posts: 9,318
Joined: Mar 17 2007
Gold: 2.20
Dec 18 2013 01:33pm
Quote (Stepepper @ 18 Dec 2013 21:29)
How are you referencing the articles (ONE,TWO,etc)? I don't see any code where the articles are referenced. Also, how are you querying the database? If you are requesting all posts, then how do you restrict which posts will display? We need to see that code.


solved by myself :)

if ( is_home() )
{
query_posts( 'cat=-'ID of the category without name' ' );
}

:)

This post was edited by nonNo on Dec 18 2013 01:33pm
Member
Posts: 2
Joined: Dec 18 2013
Gold: 0.00
Dec 18 2013 01:35pm
Damn, really wanted that key. Well need to keep searching then.
Don't stop programming!

Do you mind still sending it to me? :)

This post was edited by Stepepper on Dec 18 2013 01:40pm
Member
Posts: 2,736
Joined: Nov 28 2009
Gold: 34.00
Dec 18 2013 01:43pm
Quote (Stepepper @ 18 Dec 2013 21:29)
How are you referencing the articles (ONE,TWO,etc)? I don't see any code where the articles are referenced. Also, how are you querying the database? If you are requesting all posts, then how do you restrict which posts will display? We need to see that code.


You do that with query_posts(), nice attempt at diving into the unknown.
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll