• I wanted to know if there was a query or one could create a query like

    if is category and if sticky display the post else do nothing?

    Thanks

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter Ali Hussain

    (@b4db0y)

    I tried that, but am not able to get it to work.

    <?php
    //return sticky posts in categories 3 and 7
    query_posts(array(
    	'post__in'=>get_option('sticky_posts'),
    	'cat'=>'3,7'
    	));
    if (have_posts()) : while (have_posts()) : the_post();
    ?>
    Thread Starter Ali Hussain

    (@b4db0y)

    thanks raskull.
    I edited some parts

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $sticky=get_option('sticky_posts');
    $args=array(
    'cat'=>232,
    'caller_get_posts'=>1,
    'post__in' => $sticky,
    'paged'=>$paged,
    );
    query_posts($args); while ( have_posts() ) : the_post()  ?>

    Wanted to know, isn’t there any way for the cat number to autofill, like if the user in on the autos category it is filled as autos

    Tell me more about how/where you plan to use this…

    Thread Starter Ali Hussain

    (@b4db0y)

    i will be having a classified theme (study related)

    where there be categories like
    – ACCA
    – O Levels
    – A Levels
    – Matriculate
    – Intermediate
    etc.

    If the user visits acca, the sticky posts of ACCA be shown.
    If he visits o levls, the sticky from that category is posted.
    and so on.

    Again thankyou

    Do you have a file named category.php? That might go a long way towards what you’re looking for. It’s what results if you click a category link (if you have category.php, otherwise it moves on to archive.php). Take a look in archive.php to see what’s going on — you only need the part related to category to put in your category.php file.

    https://codex.www.ads-software.com/Template_Hierarchy
    https://codex.www.ads-software.com/Category_Templates

    My point is — category.php already knows what category to display because it came from a category link. Let me know if that doesn’t help!

    Thread Starter Ali Hussain

    (@b4db0y)

    got it working …thankz

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘WordPress Post Query’ is closed to new replies.