Adding a menu for data on a page?
-
Hello,
Pardon me if this is a silly question, but I’ve been searching these forums and really really don’t understand what it is I should be looking for.
The problem: I have created a page, and want to have a menu within that page with a list of items. When an item is clicked on, a description and corresponding gallery comes up.
This seems like it should be easy and pretty straightforward, but I don’t understand anything I’ve found related to this problem. I think it might be a jargon problem – I’m not sure what “menu” in wordpress means, it seems to be very specific, but I don’t know how else to describe what it is I’m trying to do.
If anyone can point me to a topic that would help me out or if anyone has good words of advice, I would be really, really grateful! Thanks!
-
You will either need to create the menu/list manually in the page content. Or you could create a custom page template and use wp_list_pages.
Hi Esmi,
I have created a list already in the page, but am at a total loss as to how to get the info related to each link (text+gallery) to display beside the menu when the link is clicked. I tried to make each link a .php page that would be included in a div tag where the content should be, but couldn’t find a way to make that happen. Someone suggested making each item a category, but I really, really don’t understand what that means.
Do you know of a way I could get linked content from multiple links in a manually created list to display on one page? If you have suggestions I’m all ears!
Thanks!
get_posts would probably be your best option. something like:
<?php $args = array( 'post__in' => array(5,12,23,34,47), 'post_type' => 'page' ); $pagelist = get_posts($args);?> <ul class="pagelist"> <?php foreach($pagelist as $post) : setup_postdata($post);?> <li><h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3> <?php the_content(); ?></li> <?php endforeach; ?> </ul>
So do you mean I make each item in the list a post? Do I have to assign it a category, then arrange the categories in a list? I think this is where I’m getting confused.
Thanks for your help!
The code I gave above will grab and list specific Pages – not Posts. If you want to use posts, change
'post_type' => 'page'
to'post_type' => 'post'
.Do I have to assign it a category, then arrange the categories in a list?
Not to create the list – no.
- The topic ‘Adding a menu for data on a page?’ is closed to new replies.