Barret Ruttan
Forum Replies Created
-
Forum: Themes and Templates
In reply to: Breadcrumb trailI jumped the gun a little there. Here’s a more robust version:
$breadcrumb = array(); // Get current page global $wp_query; $current = $wp_query->post; // Check if current post has ancestors if($current->ancestors) { $ancestors = array_reverse($current->ancestors); // Step through ancestors array to build breadcrumb foreach($ancestors as $i => $text) { $breadcrumb[$i] = '<a href="' . get_page_link($text) . '" title="' . attribute_escape(apply_filters('the_title', $text->post_title)) . '">'.ucfirst(strtolower(get_the_title($text))).'</a>'; } } // Insert a link to the current page $breadcrumb[] = '<a href="' . get_page_link($current->ID) . '" title="' . attribute_escape(apply_filters('the_title', $current->post_title)) . '">'.ucfirst(strtolower(get_the_title($current))).'</a>'; // Insert a link to home array_unshift($breadcrumb, '<a href="' . get_option('home') . '" alt="Home" title="Home">Home</a>'); // Display breacrumb with demarcator echo implode(' > ', $breadcrumb); }
Forum: Plugins
In reply to: W3 Total Cache & PHP readfile functionOkay, thanks for the advice, Frederick.
Forum: Plugins
In reply to: W3 Total Cache & PHP readfile functionThat would probably be a good idea. ??
I’m testing on a fresh WordPress 2.9.1 install, W3 Total Cache 0.8.5.1, default template. It works for smaller files(less than 1MB); but not for larger files(10 MB) – instead they are empty.
I’m wondering if it has something to do with the buffer?
Forum: Plugins
In reply to: W3 Total Cache & PHP readfile functionSame result. Mind you, I’m using 0.8.5, not 0.8.5.1.
Forum: Themes and Templates
In reply to: Breadcrumb trailSeems like a very sensible spot for it, JimmyJack. ??
Here’s the latest, reworked version:
<?php // created by Jon Ruttan. Based on breadcrumb menu by Chris Poole(chrispoole.com) function breadcrumb() { $url = $_SERVER['REQUEST_URI']; $urlArray = explode('/', rtrim($url, '/')); // Set $dir to the first value $dir = array_shift($urlArray); $breadcrumb = '<a href="/">Home</a>'; foreach($urlArray as $text) { $dir .= "/$text"; $breadcrumb .= ' > <a href="'.$dir.'">' . ucwords(strtr($text, '_-', ' ')) . '</a>'; } return $breadcrumb; } ?>
Forum: Plugins
In reply to: W3 Total Cache & PHP readfile functionThank you for your timely – much appreciated – reply, Frederick.
I tried your suggestion to no avail(file is empty); whereas, if I disable the plugin, the file is the correct size.
Forum: Themes and Templates
In reply to: Breadcrumb trailThanks, ancawonka. I appreciate your feedback.
I condensed the following line further after noticing the extraneous code in my previous post:
echo ' > <a href="'.$dir.'">' . ucwords(strtr($text, array('_' => ' ', '-' => ' '))) . '</a>';
What sort of issues do you foresee?
Forum: Themes and Templates
In reply to: Adding special characters between menu items using WP_LIST_PAGESHi Peter,
It’s accomplished much the same way:
$categories = wp_list_categories('title_li=&echo=0'); $categories = explode('</li>', $categories); //create array from string returned by wp_list_categories array_pop($categories); //pop last element off array echo implode(' | ', $categories);
Forum: Themes and Templates
In reply to: Adding special characters between menu items using WP_LIST_PAGESdpcalhoun,
Always happy to lend a hand :-). Good luck in your travels.
Forum: Themes and Templates
In reply to: Adding special characters between menu items using WP_LIST_PAGESdpcalhoun,
This should do the trick:
$links = wp_list_bookmarks('title_li=&categorize=0&sort_column=menu_order&echo=0'); $bookmarks = explode('</li>', $links); //create array from string returned by wp_list_bookmarks array_pop($bookmarks); //pop last element off array echo implode('<span class="divider"> | </span>', $bookmarks);
Was worth a try ;-). That’s what I ended up doing anyways. Thanks, Frederick, your plugin saved my neck.
Forum: Themes and Templates
In reply to: Adding special characters between menu items using WP_LIST_PAGESCor blimey! Thanks for pointing out that oversight, eassae. This will do the trick:
array_unshift($links, '<li class="page-'. (is_front_page() ? 'active' : 'item') .'"><a href="' . get_option('home') . '" title="Home">Home</a>');
Forum: Fixing WordPress
In reply to: Shortcodes & apostropheD’oh! I forgot that Shortcode attributes can be enclosed in double quotes.
So:
[callout title="Why Can't We Just Get Along?"]
will work.Forum: Fixing WordPress
In reply to: WordPress adds extra <p> tags and its screwing up my designForum: Themes and Templates
In reply to: Breadcrumb trailSilly me, I missed adding a space on this line:
echo ' > <a href="'.$dir.'">' . str_replace("-", " ", ucwords(strtr($text, array('_' => ' ', '-' => ' ')))) . '</a>';