-
Website
http://sorrowfulunfounded.com/ -
Original page
http://sorrowfulunfounded.com/tutorials/wordpress/table-of-contents-page -
Subscribe
All Comments -
Community
-
Top Commenters
-
Daven
2 comments · 1 points
-
Christopher Clarke
14 comments · 1 points
-
-
Popular Threads
1. Copy page.php template.
2. Rename copy table_of_contents.php
3. Make the edit I suggest in the main article.
4. Save template / upload
5. Create New Page
6. Fill in title and content
7. Select the Table of Contents custom template under Attributes.
8. Add a custom field named "toc_category_id" with the value being the ID of the category containing your chapters.
9. Publish
10. Enjoy your new table of contents page.
http://heiwuya.net/serial-fiction/the-crow/tabl... Is the page in question, and I've got screenshots of all the applicable code (I hope)
http://img59.imageshack.us/img59/3285/editcateg...
http://img185.imageshack.us/img185/4083/editthe...
http://img32.imageshack.us/img32/897/tableofcon...
I also double-checked it against the WP Codex, and tried hard-coding the value for the category in there. It seems fine to me, and I tried copy & pasting the example from the Codex, to no avail.
Try this (I haven't tried it, but I think it should work):
http://php.pastebin.com/f53118d4e
Good luck. If this works, I'll replace the code in the tutorial with it.
Code:
http://php.pastebin.com/f9be2b8e
Your new code results in a blank page (my server seems to have turned off PHP errors). But the initial problem seems to be my installation. It seems to think every post is in category 4 (even when navigating in the WP control panel).
I'm not sure about this WordPress category issue but I believe I had a similar issue when making the sidebar widget table of contents. No matter what I set the category to it was always getting the wrong posts. The solution was the same as the solution I used in the new code - using the database table field names directly instead of relying on WordPress's template functions for the title and permalink.
I have no idea what could have caused the database to screw itself up so royally, but that was the problem, not your code! Sorry for the mix-up, and thanks a lot for the help!
Is there something I'm doing wrong? This is a site I'm transferring into Wordpress, so it can blow up and I won't be TOO mad...
I haven't tested but I think replacing $toc = get_post... with $toc = get_pages('child_of='.$post->ID.'&sort_column=post_date&sort_order=ASC'); should do the trick. Of course, replace '.$post->ID.' with the ID of the page that is the parent of the chapters you want to list if it isn't the page that holds the parent (even so you might still need to replace it, I don't know).
Good luck.
Oh, the plugin I used so that others can use it is located here: http://www.megaupload.com/?d=CLBDY6U0
I downloaded that, implemented it, created categories, assigned them to pages and then, with that code change: http://davensjournal.com/Updating/beginning-wicca
I'm VERY happy now.