Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11

Thread: query page

  1. #1
    New to the CF scene
    Join Date
    Oct 2009
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Smile query page

    Hi,

    Can anyone help me to refine this line of code?

    Code:
    <?php $ids = array();
    query_posts(array('post_type' => 'page'));
    I would like to add some specific pages to query.

    I tried

    Code:
    <?php $ids = array();
    query_posts(array('post_type' => 'page' 'page_id'='329,17,14,6));
    but it doesn't work...

    Can anyone put me on the right track?

    Thanks in advance,

    All the best

  • #2
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Location
    Arkansas
    Posts
    2,644
    Thanks
    29
    Thanked 330 Times in 326 Posts
    You need to know what the query_posts function expects. Tossing in random information rarely works.
    Are you a Help Vampire?

  • #3
    New to the CF scene
    Join Date
    Oct 2009
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thank you Tom,

    How can I fix it? Shall we call the page-id right away instead of saying post_type=page?

    Thank you very much

    All the best

  • #4
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Location
    Arkansas
    Posts
    2,644
    Thanks
    29
    Thanked 330 Times in 326 Posts
    Again, you need to know what the query_posts function expects.
    Are you a Help Vampire?

  • #5
    New to the CF scene
    Join Date
    Oct 2009
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts
    the query_posts expects page but how can I tell him to expect specific pages? sorry I am very newbie with PHP... I don't want to bother...

    All the best

    Thanks

  • #6
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Location
    Arkansas
    Posts
    2,644
    Thanks
    29
    Thanked 330 Times in 326 Posts
    Did you write the function? Do you have a function definition? Do you have any code at all? Do you have documentation for the function? You can't just throw anything into a function as an argument and expect it to work.
    Are you a Help Vampire?

  • #7
    New to the CF scene
    Join Date
    Oct 2009
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Ah, you're great !!!! I tought it might be linked somehow... I attached the 2 original files and here is the code as I modified it thinking to make it work...

    Code:
    <!-- Featured Area -->
    			<div id="featured-area">
    				<div id="s1" class="pics"> 
    <?php $ids = array();
    query_posts(array('post_type' => 'page', 'page_id'=>329,17,12,7,18));
    while (have_posts()) : the_post();
    	if (get_option('enews_grab_image') == 'Enable') { $thumb = catch_that_image(); } 
    	else { $thumb = get_post_meta($post->ID, 'Thumbnail', $single = true); } ?>
    					<div style="width: 830px;">
    						<img src="<?php bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php echo $thumb; ?>&amp;h=206&amp;w=510&amp;zc=1" alt="<?php echo(the_title()); ?>" width="510px" height="206px" />
    							<div class="featured-overlay"></div>
    						
    						<h1><a href="<?php the_permalink() ?>" title="Permanent Link to <?php the_title(); ?>"><?php the_title2('', '...', true, '30'); ?></a></h1>
    						<p><?php truncate_post(350); ?></p>
    					</div>
    <?php $ids[]= $post->ID;
    endwhile; wp_reset_query(); ?>
    				</div> 
    				<!-- Featured posts thumbnails -->
    				<h3>A la Une</h3>
    				<div class="clear"></div>
    				<a id="prev-item" href="#">Prec</a>
    				<a id="next-item" href="#">Suiv</a>
    			</div> <!-- end featured area -->
    Thank you for your precious input

    All the best
    Attached Files Attached Files

  • #8
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Location
    Arkansas
    Posts
    2,644
    Thanks
    29
    Thanked 330 Times in 326 Posts
    Neither of the files in the zip show the function definition for query_posts(). You'll need that function if you want to know how to use it and/or how to modify it to make it do what you want.
    Are you a Help Vampire?

  • #9
    New to the CF scene
    Join Date
    Oct 2009
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Cool

    i am using wordpress..

    is it this one you think? Related to wordpress.

    Thanks for your patience....

    All the best
    Attached Files Attached Files

  • #10
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Location
    Arkansas
    Posts
    2,644
    Thanks
    29
    Thanked 330 Times in 326 Posts
    The place to look for Wordpress function definitions is the Wordpress Plugin API. The specific information for query_posts is here. Check out that page. Lots of useful information there.

    I think the section you're interested in is titled "Post & Page Parameters". It's a little more than half way down the page. Not sure, though, since I don't use Wordpress and can't test with anything.


    Also, I ran across this page. Not sure if there's anything there you can use.
    Are you a Help Vampire?

  • Users who have thanked tomws for this post:

    marcaurel (10-14-2009)

  • #11
    New to the CF scene
    Join Date
    Oct 2009
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thank you very much... I'll digg into it...

    I let you know what comes out.

    All the best


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •