Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme »

[SOLVED] List subpages on page?


  #1  
Old Jan 6, 2009, 08:47 AM
eriksjos
 
11 posts · Jan 2009
[SOLVED] List subpages on page?

is there a simple way to list subpages on an page?

for example in the "FOOTER: "Page" Pages"?

/erik
  #2  
Old Jan 6, 2009, 09:07 AM
Flynn's Avatar
Flynn
 
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  
Old Jan 6, 2009, 09:50 AM
eriksjos
 
11 posts · Jan 2009
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  
Old Jan 6, 2009, 07:30 PM
Flynn's Avatar
Flynn
 
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 08: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  
Old Jan 6, 2009, 10:18 PM
eriksjos
 
11 posts · Jan 2009
works fine!
and thanks again for a nice and powerful Theme and for the quick answers.
  #6  
Old Jan 22, 2009, 09:09 AM
heimir
 
10 posts · Jan 2009
- 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  
Old Jan 22, 2009, 09:27 AM
heimir
 
10 posts · Jan 2009
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  
Old Jan 22, 2009, 09:32 AM
Flynn's Avatar
Flynn
 
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
  #9  
Old Jan 22, 2009, 07:48 PM
heimir
 
10 posts · Jan 2009
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
  #10  
Old Jan 22, 2009, 08:17 PM
Flynn's Avatar
Flynn
 
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 ?>


  #11  
Old Jan 22, 2009, 09:29 AM
Flynn's Avatar
Flynn
 
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

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding list items to the Page Menu bseppa Page & Category Menu Bars 10 May 4, 2010 01:37 PM
Parent Pages Top Navigation Bar, Subpages coastal Page & Category Menu Bars 4 Jan 11, 2010 10:16 PM
[SOLVED] category page list...display images too? joshimotions Excerpts, Read more, Pagination 1 Jun 21, 2009 09:56 AM
Mailing list/newsletter recommendations. scrubbs Atahualpa 3 Wordpress theme 0 May 31, 2009 02:53 PM
Flexx theme - How to change my "List Category or Archives" to "List Titles ONLY" ?? idaks01 Post-Kicker, -Byline & -Footer 0 Mar 28, 2009 05:22 PM


All times are GMT -6. The time now is 10:46 AM.


Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.