Barret Ruttan
Forum Replies Created
-
Forum: Themes and Templates
In reply to: Breadcrumb trail*Added functionality to capitalize trail items & remove underscores & hyphens:
<?php// breadcrumb trail created by Jon Ruttan, based on breadcrumb menu by Chris Poole(chrispoole.com)
function breadcrumb() {
$url = $_SERVER[“REQUEST_URI”];
$urlArray = array_slice(explode(“/”,$url), 0, -1);// Set $dir to the first value
$dir = array_shift($urlArray);
echo ‘Home‘;
foreach($urlArray as $text) {
$dir .= “/$text”;
echo ‘ > ‘ . str_replace(“-“, ” “, ucwords(str_replace(‘_’, ‘ ‘, $text))) . ‘‘;
}
}
?>Forum: Fixing WordPress
In reply to: Menu Bar SeparatorsYou can add a link to the index by adding the following:
array_unshift($links, '<li class="page-item"><a href="' . get_option('home') . '" title="Home"> Home </a>');
before:
implode(' | ', $links);
Forum: Themes and Templates
In reply to: Help with wp_list_pages on horizontal menu barYou can add a link to the index by adding the following:
array_unshift($links, '<li class="page-item"><a href="' . get_option('home') . '" title="Home"> Home </a>');
before:
implode(' | ', $links);
Forum: Themes and Templates
In reply to: Adding special characters between menu items using WP_LIST_PAGESYou can add a link to the index by adding the following:
array_unshift($links, '<li class="page-item"><a href="' . get_option('home') . '" title="Home"> Home </a>');
before:
implode(' | ', $links);
Forum: Themes and Templates
In reply to: Adding special characters between menu items using WP_LIST_PAGESGlad it worked out for you, Andrew.
Forum: Themes and Templates
In reply to: Help with wp_list_pages on horizontal menu barGlad it worked out for you, alevs.
Forum: Plugins
In reply to: Getting a WP user’s roleYet another method:
global $current_user;
get_currentuserinfo();
if($current_user->user_level == 0){ /* Is user subscriber? */
}*See: User Level to Role Conversion to set appropriate value for user_level.
Forum: Fixing WordPress
In reply to: Menu Bar SeparatorsThe following snippet in your template will output the desired effect, just change | character in echo implode(‘ | ‘, $links); to whatever you like;
<?php $links = get_pages(); foreach($links as $i => $page) $links[$i] = '<li class="page-' . (is_page($page->ID) ? 'active' : 'item') . '"><a href="' . get_page_link($page->ID) . '" title="' . attribute_escape(apply_filters('the_title', $page->post_title)) . '">' . apply_filters('the_title', $page->post_title) . '</a></li>'; echo implode(' | ', $links); ?>
Forum: Themes and Templates
In reply to: Extra characters in the wp_list_pagesAlternatively, the following snippet in your template will output the desired effect:
<?php $links = get_pages(); foreach($links as $i => $page) $links[$i] = '<li class="page-' . (is_page($page->ID) ? 'active' : 'item') . '"><a href="' . get_page_link($page->ID) . '" title="' . attribute_escape(apply_filters('the_title', $page->post_title)) . '">' . apply_filters('the_title', $page->post_title) . '</a></li>'; echo implode(' | ', $links); ?>
Forum: Themes and Templates
In reply to: Adding special characters between menu items using WP_LIST_PAGESThe following snippet in your template will output the desired effect:
<?php $links = get_pages(); foreach($links as $i => $page) $links[$i] = '<li class="page-' . (is_page($page->ID) ? 'active' : 'item') . '"><a href="' . get_page_link($page->ID) . '" title="' . attribute_escape(apply_filters('the_title', $page->post_title)) . '">' . apply_filters('the_title', $page->post_title) . '</a></li>'; echo implode(' | ', $links); ?>
Forum: Themes and Templates
In reply to: Help with wp_list_pages on horizontal menu barThe following snippet in your template will output the desired effect:
<?php $links = get_pages(); foreach($links as $i => $page) $links[$i] = '<li class="page-' . (is_page($page->ID) ? 'active' : 'item') . '"><a href="' . get_page_link($page->ID) . '" title="' . attribute_escape(apply_filters('the_title', $page->post_title)) . '">' . apply_filters('the_title', $page->post_title) . '</a></li>'; echo implode(' | ', $links); ?>
Forum: Fixing WordPress
In reply to: Odd question: separator for a list generated by wp_list_pagesThe following snippet in your template will output the desired effect:
<?php $links = get_pages(); foreach($links as $i => $page) $links[$i] = '<li class="page-' . (is_page($page->ID) ? 'active' : 'item') . '"><a href="' . get_page_link($page->ID) . '" title="' . attribute_escape(apply_filters('the_title', $page->post_title)) . '">' . apply_filters('the_title', $page->post_title) . '</a></li>'; echo implode(' | ', $links); ?>