• 0

Wordpress Theme question


Question

Ok, so I switched to Wordpress to give it a shot and have a couple of questions.

First, the current theme I have loaded is ok. I like it, but the presentation area

is boring. It's just a simple white space.

http://www.richardmccord.com

I tried another theme which I like better (http://wordpress.org/extend/themes/chocotheme)

but the menu system in it sucks. By sucks, I mean I can't get it to work for me

like my current theme does.

Second question:

Across the top of the page are my Categories: Stories, Reviews, Opinions, ect.

What I would like is to have a seperate sidebar for each of those Category pages.

So if you click on Stories, the sidebar would show further Categories like: Horror,

Sci-fi, etc.

Link to comment
Share on other sites

12 answers to this question

Recommended Posts

  • 0

If you want a sidebar, you'll need to edit sidebar.php. To display child categories when you're in parent category, you'd use the following:

 <?php if (is_category('name')) { ?>
 <ul> 
        <?php wp_list_categories('orderby=id&child_of=24'); ?>
 </ul>
 <?php } ?>

That's rather harsh though as it requires a specific category (in this case "name" or ID #24). I didn't look around to see what query you'd use to just show in general much like you do with child subpages.

Which in case you want:

 	<?php if (is_page()) { ?>

		<?php
  			if($post->post_parent)
  			$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
  			else
  			$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
  			if ($children) { ?>
		<div id="subpages">	
			<h3>Subpages</h3>
  			<ul>
  				<?php echo $children; ?>
  			</ul>
		</div>
		<?php } ?>

Link to comment
Share on other sites

  • 0

My first question didn't really ask the question.

The Choco theme I linked to has an awesome layout for what

I need. The presentation area (white space) is displayed in

such a way as to put focus on what's written there. I like

that. Is there any way to change the presentation area of

my current theme to look like that?

OR, is there a theme with a similar layout that supports

the new Menu function? I've been looking and can't find

one.

Link to comment
Share on other sites

  • 0

You're right: the only question you asked was how to display child categories in your sidebar.

If you want your theme to look like another, then simply edit the CSS and HTML in the theme to your liking. You don't ~have~ to keep it as is. Just edit it.

Link to comment
Share on other sites

  • 0

Arg.

Ok, here's what I've got so far with my sidebar.

<div id="sidebar">
<?php
if (is_category()) {
  $this_category = get_category($cat);
  if (get_category_children($this_category->cat_ID) != "") {
    echo "<h1>Subcategories</h1>";
    echo "<ul>";
    wp_list_categories('orderby=id&show_count=0&title_li=
&use_desc_for_title=1&child_of='.$this_category->cat_ID);
    echo "</ul>";
  }
}
?>
</div>

The idea is to check the Category page I'm in and the Sidebar will list its child categories.

At the moment, only Categories that have Child Categories are doing anything.

Stories has child categories of: Horror, Sci-Fi, Fantasy and Western. But instead of

listing those, it lists: Subcategories and then No categories.

The Categories that do NOT have a child categore like Opinions don't show a sidebar

at all.

Link to comment
Share on other sites

  • 0

That's if there aren't any. I know this.

I was pointing out that the code is obviously seeing if a Category has children, so that

part works. But then it's not showing the children as I expected it to. Does that make more

sense?

Link to comment
Share on other sites

  • 0

What do you mean it's not showing the child categories as you expect? If a specific parent category does not have any child categories, then there is nothing to display. Child categories will only be present if they exist.

child_of

(integer) Only display categories that are children of the category identified by this parameter. There is no default for this parameter.

http://codex.wordpress.org/Template_Tags/wp_list_categories

Link to comment
Share on other sites

  • 0

Ok, so I'm extremely stuck on my Navigation.

I've got the site layout looking the way I like and acting like I want it to, all except for the navigation aspect.

The top menu shows my main Categories. This is perfect. If you click on About The Author it takes you to

that post. Perfect. But I can't figure out how to do the others.

For Poems, I want the user to be able to click on Poems in the top menu and then have a sidebar menu listing

all the poems by title. I assume they would be Pages.

If you click on Stories, then the sidebar should show the story Categories like Horror, Sci-fi, etc. Then when you

click that, it would turn into a sidebar menu like Poems where the stories are listed by title.

I can't figure out how to do this. Nor, how to actually do stories since they aren't one-page blogs.

Any suggestions here?

Link to comment
Share on other sites

  • 0

First off: You can't use categories with pages. You can only use posts.

I really think that your "About the Author" should not be a post but rather a parent page. Nevermind, I looked at your site and it is a page. As far as your poems go, if you're going to want them to be categorized, then you will need to create them as posts and not pages. You will not be able to categorize them if you want them as pages. You can only have parent pages.

I just really think that you're confusing yourself with how Wordpress actually works and how things should be laid out within the backend.

When you access categories themselves on Wordpress it is essentially an "archive" that you're using. ALL posts under that category are made available although how many are seen per page are decided on the option you made under admin's settings. To show posts in the sidebar wouldn't make much sense as when you're in that category, all posts would be shown already. I think your best bet is to just show ALL categories under the parent versus poem titles.

Otherwise you might just want to consider creating a category-poems.php (assuming Poems is just Poems) so that you can customize how all poem posts are shown.

In a sidebar doesn't make sense when you're in a category that already displays all posts.

http://codex.wordpress.org/Category_Templates

Link to comment
Share on other sites

  • 0

Ok, I got everything displaying correctly now... by that, I mean that if you Click on stories the Sidebar

shows Stories and then the sub-categories under it. Looks sweet.

I understand what you mean by Posts vs. Pages. The wife is using Joomla and it has an interesting

hierarchy of: Section->Category->Article. I might should have gone with that for my CMS, but I

just got Wordpress acting the way I wanted it to so I'll look into other ways to Navigate my

multiple page stuff like stories.

Link to comment
Share on other sites

  • 0

Cupcakes, hi, I'm new to this site, and found your answers to McCordRm.

I am also using Chocotheme, and need some category to show a different heading in this site (www.institutosantaana.edu.ar).

Which file should I edit to achieve this? Is it archive.php, inside the theme?

I have read (but maybe not fully understood) the guide in this page> http://codex.wordpress.org/Category_Templates.

Tnx in advance.

Nano H2

If you want a sidebar, you'll need to edit sidebar.php. To display child categories when you're in parent category, you'd use the following:

 <?php if (is_category('name')) { ?>
 <ul> 
        <?php wp_list_categories('orderby=id&child_of=24'); ?>
 </ul>
 <?php } ?>

That's rather harsh though as it requires a specific category (in this case "name" or ID #24). I didn't look around to see what query you'd use to just show in general much like you do with child subpages.

Which in case you want:

 	<?php if (is_page()) { ?>

		<?php
  			if($post->post_parent)
  			$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
  			else
  			$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
  			if ($children) { ?>
		<div id="subpages">	
			<h3>Subpages</h3>
  			<ul>
  				<?php echo $children; ?>
  			</ul>
		</div>
		<?php } ?>

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.