|
#1
Jan 6, 2009, 09:47 AM
|
|
is there a simple way to list subpages on an page?
for example in the "FOOTER: "Page" Pages"?
/erik
|
#2
Jan 6, 2009, 10:07 AM
|
|
|
|
3,768 posts · Oct 2008
Munich, Germany
|
|
Try this to put it before or after the post footer. (Inside post footer would require bigger changes)
In index.php find
PHP Code:
<?php // Post Footer if( (is_home() && $bfa_ata_post_footer_home != "") OR (is_page() && $bfa_ata_post_footer_page != "") OR (is_single() && $bfa_ata_post_footer_single != "") OR ( (is_archive() OR is_search() OR is_author() OR is_tag()) && $bfa_ata_post_footer_multi != "") ) { echo '<div class="post-footer">'; if ( is_home() ) { echo postinfo("$bfa_ata_post_footer_home"); } elseif ( is_page() ) { echo postinfo("$bfa_ata_post_footer_page"); } elseif ( is_single() ) { echo postinfo("$bfa_ata_post_footer_single"); } else { echo postinfo("$bfa_ata_post_footer_multi"); } echo '</div>'; } ?>
and paste this before or after it
PHP Code:
<ul> <?php wp_list_pages('title_li=&child_of='.$post->ID); ?> </ul>
|
#3
Jan 6, 2009, 10:50 AM
|
|
Worked fine, thanks for the quick reply.
And if i want to exclude the list of subpages on one ore some pages?
regards
/erik
|
#4
Jan 6, 2009, 08:30 PM
|
|
|
|
3,768 posts · Oct 2008
Munich, Germany
|
|
Then replace
PHP Code:
<ul> <?php wp_list_pages('title_li=&child_of='.$post->ID); ?> </ul>
with
PHP Code:
<?php $not_on_these_pages = array(11,18,108); if (is_page() AND !in_array($post->ID, $not_on_these_pages)) { ?> <ul> <?php wp_list_pages('title_li=&child_of='.$post->ID); ?> </ul> <?php } ?>
Replace 11,18,108 with the IDs of the pages where subpages should not be displayed. To get the ID of a page, click on "Pages" in the WP Site Admin and hover over the Page Title so see a URL ending on "...post= XXX" in the browser status bar. XXX is the page ID.
I have not tried this, let me know if it doesn't work...
Last edited by Flynn; Jan 6, 2009 at 09:05 PM.
Reason: Edited to include "if is page" to avoid empty <ul> ... </ul> being displayed on non-pages or pages without sub pages
|
#5
Jan 6, 2009, 11:18 PM
|
|
works fine!
and thanks again for a nice and powerful Theme and for the quick answers.
|
#6
Jan 22, 2009, 10:09 AM
|
|
- following on from this, I would like to be able to list these children subcategories in the left sidebar rather than the main page (and then get rid of the full category menu). Couldn't quite seem to hit the right place with the code.
I've only just come across Atahualpa and I think it's awesome!. Thanks Flyn
Heimir
|
#7
Jan 22, 2009, 10:27 AM
|
|
following from my post above - alternately, is it possible to get the category menu in the left sidebar to collapse down to level you are at? I'm trying to emulate the menu that IKEA have on their site at
http://www.ikea.com/gb/en/catalog/allproducts/
|
#8
Jan 22, 2009, 10:29 AM
|
|
|
|
3,768 posts · Oct 2008
Munich, Germany
|
|
I assume you want (only) the sub categories listed when on a parent category
To do this,
for the left sidebar, in header.php, line 891, find
HTML Code:
<td id="left">
or for the right sidebar, in footer.php, line 66, find
HTML Code:
<td id="right">
and add the following code below it
PHP Code:
<?php if ( is_category() ) { $current_cat_id = get_query_var('cat'); ?> <div class="widget"><div class="widget-title"> <h3>YOUR WIDGET TITLE</h3></div> <div class="widget-content"> <ul><?php wp_list_categories('title_li=&child_of=' . $current_cat_id); ?></ul> </div></div> <?php } ?>
You could leave out this part if you want no widget title
PHP Code:
<div class="widget-title"> <h3>YOUR WIDGET TITLE</h3></div>
|
#9
Jan 22, 2009, 10:32 AM
|
|
|
|
3,768 posts · Oct 2008
Munich, Germany
|
|
Quote:
Originally Posted by heimir
following from my post above - alternately, is it possible to get the category menu in the left sidebar to collapse down to level you are at? I'm trying to emulate the menu that IKEA have on their site at
http://www.ikea.com/gb/en/catalog/allproducts/
|
That seems to be about the same what I posted above. They show the subcategories of the given parent category in the sidebar.
After you implemented the code from above you could set the category menu bar to display only one level at Theme Options -> Category Menu Bar -> Depth of Category Menu Bar
|
#10
Jan 22, 2009, 08:48 PM
|
|
Flynn, - Thanks for replying so soon.
I put that code in but nothing at all showed up in the sidebar. I noticed the word 'category' in the code and this is a 'page' rather than a 'post' so I tried changing it to this code
<?php if ( is_page() ) {
$current_cat_id = get_query_var('cat'); ?>
<div class="widget"><div class="widget-title">
<h3>YOUR WIDGET TITLE</h3></div>
<div class="widget-content">
<ul><?php wp_list_pages('title_li=&child_of=' . $current_cat_id); ?></ul>
</div></div>
<?php } ?> with the result that it showed up OK in the sidebar, along with its widget title but included all the categories rather than just the children. My ignorance of PHP is profound so I wonder what I'm doing wrong
best wishes
Heimir
|
#11
Jan 22, 2009, 09:17 PM
|
|
|
|
3,768 posts · Oct 2008
Munich, Germany
|
|
You mentioned categories and subcategories that's why I posted the code for categories...
For pages:
PHP Code:
<?php if ( is_page() ) { $current_page_id = $wp_query->get_queried_object_id(); ?> <div class="widget"><div class="widget-title"> <h3>YOUR WIDGET TITLE</h3></div> <div class="widget-content"> <ul><?php wp_list_pages('title_li=&child_of=' . $current_page_id); ?></ul> </div></div> <?php } ?>
|
#12
Jan 22, 2009, 09:37 PM
|
|
Flynn,
yes you're right. I meant pages. Sorry. Many thanks for the reply, it works perfectly!
best wishes
Heimir
|
#13
Feb 4, 2009, 03:56 AM
|
|
Hi,
I want to exclude the subpages on my main navigation menu ( top bar ) as I just want the subpages to be displayed on my side bar but I can't find any solutions to this problem. Can anyone please advise? Thanks.
|
#15
Aug 3, 2009, 07:34 AM
|
|
how do I list subpages in the latest version? 3.4.2?
|
#16
Aug 3, 2009, 07:58 AM
|
|
|
|
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
|
|
where do you want them displayed? footer? sidebar? menubar?
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
|
#17
Aug 6, 2009, 04:41 AM
|
|
under the post in the "post footer" for example.
|
#18
Nov 12, 2009, 12:09 AM
|
|
any suggestions?
|
#19
Nov 12, 2009, 06:53 AM
|
|
|
|
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
|
|
Yoiu would want to put this code at ATO->Style & edit CENTER COLUMN->The LOOP in the area
HTML Code:
<?php bfa_post_footer('<div class="post-footer">','</div>'); ?>
this is what kicks off the footer code, so this is where it should go
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
|
#20
Nov 12, 2009, 07:16 AM
|
|
ok, thanks.
But now i get a list of all pages.
I would like to have a list of just the sub-pages of the page.
And i also would like to exklude the function on some pages.
/erik
|
#21
Nov 13, 2009, 05:53 AM
|
|
|
|
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
|
|
well you can exclude the function from showing on some pages by using a conditional. What is the exact code you used?
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
|
#22
Nov 13, 2009, 06:04 AM
|
|
i use the code from #4 above:
HTML Code:
<?php
$not_on_these_pages = array(1066);
if (is_page() AND !in_array($post->ID, $not_on_these_pages)) { ?>
<ul>
<?php
wp_list_pages('title_li=&child_of='.$post->ID); ?>
</ul>
<?php } ?>
|
#23
Nov 14, 2009, 07:35 AM
|
|
|
|
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
|
|
Ah this is happening because the $page->ID is blank, so by default all pages are returned.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
|
#24
Nov 14, 2009, 10:29 AM
|
|
ok, and how do I get the PageId?
|
#25
Nov 16, 2009, 07:37 AM
|
|
|
|
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
|
|
Try this in version 3.4.4:
HTML Code:
<?php $not_on_these_pages = array(201);
global $post;
if (is_page() AND !in_array($post->ID, $not_on_these_pages)) {
echo '<ul>';
wp_list_pages('title_li=&child_of='.$post->ID);
echo '</ul></div>';
} ?>
put the page ID you DO NOT want this to work on in array(111, 222, 333, etc)
position this code in 'ATO->Style & edit CENTER COLUMN->TheLOOP' before or after the line
HTML Code:
<?php bfa_post_footer('<div class="post-footer">','</div>'); ?>
depending on where you want the sub pages to show up.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
|
|