Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Atahualpa 3 Wordpress theme (http://forum.bytesforall.com/forumdisplay.php?f=2)
-   -   [SOLVED] List subpages on page? (http://forum.bytesforall.com/showthread.php?t=100)

eriksjos Jan 6, 2009 08:47 AM

[SOLVED] List subpages on page?
 
is there a simple way to list subpages on an page?

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

/erik

Flynn Jan 6, 2009 09:07 AM

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>


eriksjos Jan 6, 2009 09: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

Flynn Jan 6, 2009 07:30 PM

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...

eriksjos Jan 6, 2009 10:18 PM

works fine!
and thanks again for a nice and powerful Theme and for the quick answers.

heimir Jan 22, 2009 09: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

heimir Jan 22, 2009 09: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/

Flynn Jan 22, 2009 09:29 AM

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


Flynn Jan 22, 2009 09:32 AM

Quote:

Originally Posted by heimir (Post 439)
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

heimir Jan 22, 2009 07: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

Flynn Jan 22, 2009 08:17 PM

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 ?>




heimir Jan 22, 2009 08:37 PM

Flynn,

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

best wishes

Heimir

kellychui Feb 4, 2009 02: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.

Flynn Feb 4, 2009 04:46 AM

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.

eriksjos Aug 3, 2009 06:34 AM

how do I list subpages in the latest version? 3.4.2?:)

juggledad Aug 3, 2009 06:58 AM

where do you want them displayed? footer? sidebar? menubar?

eriksjos Aug 6, 2009 03:41 AM

under the post in the "post footer" for example.

eriksjos Nov 11, 2009 11:09 PM

any suggestions?

juggledad Nov 12, 2009 05:53 AM

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

eriksjos Nov 12, 2009 06: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

juggledad Nov 13, 2009 04:53 AM

well you can exclude the function from showing on some pages by using a conditional. What is the exact code you used?

eriksjos Nov 13, 2009 05: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 } ?>


juggledad Nov 14, 2009 06:35 AM

Ah this is happening because the $page->ID is blank, so by default all pages are returned.

eriksjos Nov 14, 2009 09:29 AM

ok, and how do I get the PageId?

juggledad Nov 16, 2009 06:37 AM

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.


All times are GMT -6. The time now is 06:04 PM.

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