Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

So basically I have custom post types set up, and one of these is called Packages. It's for a web design/SEO company. I need the nav link Packages to show in the navigation and all of the child links for the link Packages will be all of the posts inside the Packages custom post type. If that's too confusing, just tell me and I can explain more.

What I need to know is how can I make the posts in the Packages custom post type to show as the child pages of the Products page.

Any way this can be done? Preferably with PHP or jQuery.

Edit: This is what I have so far:

<?php 
    $pages = get_pages('parent=0'); 
    foreach ($pages as $pagg) { $key = 'childpages'; $id = get_the_ID();
        $args = array( 'post_type' => 'products' );
        $loop = new WP_Query( $args );
    if(get_post_meta($id, $key, true) == 'products') :
        $option = '<li><a href="'.get_page_link($page->ID).'">';
        $option .= $pagg->post_title;
        $option .= '</a>';
        $option .= '<ul class="children"';
        while ( $loop->have_posts() ) : $loop->the_post();
            $option .= '<li>';
            $option .= the_title();
            $option .= '</li>';
        endwhile;
        $option .= '</ul></li>';
    else : 
        $option = '<li><a href="'.get_page_link($page->ID).'">';
        $option .= $pagg->post_title;
        $option .= '</a></li>';
    endif;
    echo $option; }
?>

If the page has a custom field of childpages with the value products, display them as the child pages. Will this even work?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Hi @Jared

One idea is to look at the 'rewrite' argument for custom post types.

You can also create a [shortcode] and create a page in your functions.php file for displaying the Packages.

share|improve this answer
    
This actually lead me to a better solution, I didn't think about using custom menus. Thanks. :) –  Jared Feb 4 '11 at 20:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.