• I have a theme-blog with a custom home-page, and on that homepage (home.php) there is a header, with a horizontal headermenu, just like on www.ads-software.com (thats why I chose it). Because I want to combine a blog with a site, I want to have some more ‘static pages’. But simply making a page doesn’t put it in the horizontal menu, only categories get into there.

    In the theme I got, this is the menucode, that lists the categories in the horizontal headermenu:

    <?php KFPrintCategories( $categories_to_exclude, false ); ?>
    <li class="current-cat"><a href="<?php bloginfo('siteurl'); ?>/" title="Home">Home</a></li>

    This displays the categories in the header. So if I make a category to post in, it shows up in the headermenu. But since I want the pages (page: add new) to show up there and not the categories, I changed the code to:

    <li><a href="<?php echo get_option('home'); ?>/">Home</a></li>
    <?php wp_list_pages('title_li=&depth=1&'.$page_sort.'&'.$pages_to_exclude)?>

    that shows the pages, like ‘about’ and ‘contact’. These pages are editable, so I like it so far.

    But now, when I add a post, I have to add it to a category! And the categories, ass you guess, do not show up in the headermenu anymore. So the only way to reach the ‘blogsection’ is through clicking the post on the homepage.

    I don’t like that.

    How can I fix this?

    What I want is: a homepage, about 4 other pages, like ‘about’, ‘contact’, ‘portfolio’ that have the same header and footer, but an adjustable content. But I also want a page called ‘blog’, where all my posts (in different categories) should be on!

    All these pages (blog and about and contact) should be in the headermenu.

    (maybe it is because I cannot get all posts to appear only on a ‘page’, they somehow go onto a ‘category-page’ instead.)

    Who understands my problem, and knows a way out?

Viewing 6 replies - 1 through 6 (of 6 total)
  • To have a page called blog, that displays the main loop of posts, try this

    (you may have a blog template in your theme already, see if when you create a page, from the attributes you can choose “blog”).

    1 – create a new file in your theme folder and call it page-blog.php
    In that file put the following

    <?php /*
    	Template Name: Blog
    */ ?>
    
    <?php include (TEMPLATEPATH . '/index.php'); ?>

    Now you have a blog template with the loop from the index file.

    2 – In WordPress, create a new page called “Blog”, this page will appear in the menu tabs automatically (now that you have wp_list_pages)

    3 – From the attributes, select “blog” as the template. Publish.

    It should work fine.

    I am assuming you don’t have the full loop in your “home” page? Just featured posts? If the above doesn’t solve your problem, please provide a link to your site, so we can look at it.

    Thread Starter dekraan

    (@dekraan)

    Thank you. I will try this when I get off work. At the moment I have:

    <li><a href="<?php echo get_option('home'); ?>/">Home</a></li>
    <?php wp_list_pages('title_li=&depth=1&'.$page_sort.'&'.$pages_to_exclude)?>
    <?php wp_list_categories('title_li=&depth=1&'.$category_sort.'&'.$categories_to_exclude)?>

    which displays the cat’s and pages in the header. Sort of solves my problem, I think. Although it might still give me problems with the subcategories.

    I’ll try your method, and see what I run into!

    Thread Starter dekraan

    (@dekraan)

    Hello buddha,

    it seems to work! Now I have a page that has got a post on it. I just don’t know which one. The one that is on there now isn’t one that I have made. I think because I need to attach my posts to a category, I could best work with categories, and use my own way as I have described above this post, with displaying categories and pages in the header. That seems to work. I only have to see what it will do to subcategories, but that surely is no problem.

    For the time being (don’t mind the coding, I am cluttering it a bit playing) my blog is at https://www.manenburg.nl/blog/ pherhaps you can see some better sollution with that as a helper!

    dekraan,

    I visited your site, and I am a little confused now.

    You have two blog tabs, of which one is a page, and one is a category.
    The page is not showing the loop, which means that probably the theme is built differently than a normal index page.

    It’s a premium paid theme, so I can’t download it to check.
    But they offer support on their site for paid themes
    https://www.themespinner.com/support/
    You may want to ask them.

    Another thing you can try, in the “Blog” template that you created, instead of calling the TEMPLATEPATH to the index page, try to incorporate a normal loop. You have a loop in the “category” blog, so copy the content of that in the “page” blog template and see if it works.

    Thread Starter dekraan

    (@dekraan)

    Buddha,

    I am also confused! ?? the reason I have the two ‘blogs’ is that I found that making it a category (like this) worked, and then I added your method. I will try and copy the loop from the category page to the normal page, and see what happens!

    The support on themespinner is rather worthless by the way. I have registered but they do not ‘approve’ my account, so I can’t post anything. I’ve tried pm’ing as well, or mailing the supportadress, but I think no one’s home, sadly.

    EDIT:

    I am somewhat confused of what I should copy/paste.

    Is it:

    <?php if (have_posts()) : ?>
    					<?php $post = $posts[0];  ?>
    					<div class="post">
    						<div class="entry">
    						<?php while (have_posts()) : the_post(); ?>
    							<div style="text-align:justify;">
    								<?php the_content(); ?>
    								<?php comments_template(); // Get wp-comments.php template ?>
    						<?php endwhile; ?>
    							</div>
    						</div>
    					</div>
    				<?php else : ?>
    					<?php include (TEMPLATEPATH . '/notfound.php');?>
    				<?php endif; ?>

    I can not find anything else. This is from the Page Template (page.php) section. If you are very keen on helping me (which would be very appreciated), pherhaps I could mail you the documents, or let you have a peek on my dashboard!

    dekraan,

    page.php usually will give you the single post content (like you see when clicking on a permalink), not the loop. But at first glance, the code seems about right…

    Try to double check with index.php from the Default theme.

    Yes, it’s fine to take a look at your theme files. I just need the theme, not the dashboard.
    I have a contact page on my site (click on my gravatar), send me a note and I will email you back.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘headermenu: pages, categories, combination?’ is closed to new replies.