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, 09:47 AM
eriksjos
 
11 posts · Jan 2009
is there a simple way to list subpages on an page?

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

/erik
  #2  
Old Jan 6, 2009, 10: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, 10: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, 08: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 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  
Old Jan 6, 2009, 11: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, 10: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, 10: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, 10: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
  #9  
Old Jan 22, 2009, 10: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
  #10  
Old Jan 22, 2009, 08: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
  #11  
Old Jan 22, 2009, 09: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 ?>


  #12  
Old Jan 22, 2009, 09:37 PM
heimir
 
10 posts · Jan 2009
Flynn,

yes you're right. I meant pages. Sorry. Many thanks for the reply, it works perfectly!

best wishes

Heimir
  #13  
Old Feb 4, 2009, 03:56 AM
kellychui
 
1 posts · Feb 2009
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.
  #14  
Old Feb 4, 2009, 05:46 AM
Flynn's Avatar
Flynn
 
3,768 posts · Oct 2008
Munich, Germany
Set "Page Menu Bar" -> "Depth of Page Menu Bar" to 1 and put one of these widgets into a sidebar

http://wordpress.org/extend/plugins/subpages-widget/

http://wordpress.org/extend/plugins/...bpages-widget/

I have used the second one. It used to work only if it was the first widget in a sidebar (= the widget on the very top). That may be the case for the other widget as well.
  #15  
Old Aug 3, 2009, 07:34 AM
eriksjos
 
11 posts · Jan 2009
how do I list subpages in the latest version? 3.4.2?
  #16  
Old Aug 3, 2009, 07:58 AM
juggledad's Avatar
juggledad
 
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  
Old Aug 6, 2009, 04:41 AM
eriksjos
 
11 posts · Jan 2009
under the post in the "post footer" for example.
  #18  
Old Nov 12, 2009, 12:09 AM
eriksjos
 
11 posts · Jan 2009
any suggestions?
  #19  
Old Nov 12, 2009, 06:53 AM
juggledad's Avatar
juggledad
 
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  
Old Nov 12, 2009, 07:16 AM
eriksjos
 
11 posts · Jan 2009
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  
Old Nov 13, 2009, 05:53 AM
juggledad's Avatar
juggledad
 
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  
Old Nov 13, 2009, 06:04 AM
eriksjos
 
11 posts · Jan 2009
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  
Old Nov 14, 2009, 07:35 AM
juggledad's Avatar
juggledad
 
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  
Old Nov 14, 2009, 10:29 AM
eriksjos
 
11 posts · Jan 2009
ok, and how do I get the PageId?
  #25  
Old Nov 16, 2009, 07:37 AM
juggledad's Avatar
juggledad
 
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

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 02:37 PM
Parent Pages Top Navigation Bar, Subpages coastal Page & Category Menu Bars 4 Jan 11, 2010 11:16 PM
[SOLVED] category page list...display images too? joshimotions Excerpts, Read more, Pagination 1 Jun 21, 2009 10:56 AM
Mailing list/newsletter recommendations. scrubbs Atahualpa 3 Wordpress theme 0 May 31, 2009 03: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 06:22 PM


All times are GMT -6. The time now is 06:43 AM.


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