lmann
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: child links disappear when clickedTook a different approach. Thanks anyways.
Forum: Fixing WordPress
In reply to: calling template sidebarFor anyone who is interested in having only specific pages show on a unique sidebar in a unique page template, you can use the code above. If you want to have multiple template exclusions the code is below:
<?php
$template = ‘clients.php’; //name of custom page template
$template2 = ‘photo.php’; //name of 2nd custom page temp$Pages = $wpdb->get_col(“SELECT post_id FROM $wpdb->postmeta WHERE meta_key = ‘_wp_page_template’ AND meta_value = ‘$template'”);
foreach($Pages as $Page) {
$exclude_Pages .= $Page . ‘,’;
}
$Pages = $wpdb->get_col(“SELECT post_id FROM $wpdb->postmeta WHERE meta_key = ‘_wp_page_template’ AND meta_value = ‘$template2′”);
foreach($Pages as $Page) {
$exclude_Pages .= $Page . ‘,’;
}
wp_list_pages(“exclude=$exclude_Pages&title_li=”);
?>Forum: Fixing WordPress
In reply to: calling template sidebarHow would it work if I wanted to exclude multiple templates, for example: clients.php and articles.php?
<?php
$template = ‘clients.php’;$Pages = $wpdb->get_col(“SELECT post_id FROM $wpdb->postmeta WHERE meta_key = ‘_wp_page_template’ AND meta_value = ‘$template'”);
foreach($Pages as $Page) {
$exclude_Pages .= $Page . ‘,’;
}
wp_list_pages(“exclude=$exclude_Pages&title_li=”);
?>Forum: Fixing WordPress
In reply to: calling template sidebarThats great – thanks!
Forum: Fixing WordPress
In reply to: calling template sidebarThanks –
but will your example automatically update the sidebar unique to the specific template page. Basically, will I need to go into the php code for a specific sidebar to exclude certain pages everytime I create a new page.
A work around for this is creating multiple authors and then assigning authors to a page, this way only pages who are written by a certain author will appear in a particular sidebar. I would like to apply the same thing to page templates. Basically, whenever I create a page, I assign it to a specific page template. The unique sidebar associated with that specific template will then be automatically updated. Thanks for your help