Change menu item from post to page
-
Here’s my site: https://dazestate.com/. It doesn’t look like much right now but I’m focusing on the menu (above the header). Right now my script that makes the menu boxes looks like this:
<ul class="link-item-menu"> <?php $feature_post = get_posts( 'category=6&numberposts=1' ); ?> <?php foreach( $feature_post as $post ) : setup_postdata( $post ); ?> <li><h2 class="link-item-menu"><?php the_category(' '); ?></h2></li> <?php endforeach; ?> </ul>
I would like my menu items to point to pages instead of post categories. How could I change the above code to achieve this? I tried this:
<ul class="link-item-menu"> <?php $page_id = 0; $page_data = get_page( $page_id ); ?> <li><h2 class="link-item-menu"><?php $page_data->post_title;?></h2></li> </ul>
but no title showed up. Whats wrong?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Change menu item from post to page’ is closed to new replies.