Profile
Achievement
 
    
                cyberhobo's Recent Snippets
- All /
 « Prev 1 Next »
Geo Mashup contextual maps display the results of a WordPress query, so they can be very useful in combination with the WordPress `query_posts` function. This example maps post with an example tag, but any call to `query_posts` could be substituted....
        
        
        
            0 
        
        
            1251 
        
                    posted 15 years ago by cyberhobo
            This template code will work only in the WordPress Loop to include a map if the Geo Mashup plugin is active and the current post has a location.
        
        
        
            0 
        
        
            1373 
        
                    posted 15 years ago by cyberhobo
            Use this code in a WordPress template with the Geo Mashup plugin (see URL) to include a global map within a post or page, centered on that post or page's location, with marker highlighted.
        
        
        
            0 
        
        
            1139 
        
                    posted 15 years ago by cyberhobo
            This makes template code that applies to children of a particular page much more readable, especially if you can use a page path instead of an ID: `if ( is_child_of( 'topic/subtopic' ) ) :`.
        
        
        
            1 
        
        
            1334 
        
                    posted 16 years ago by cyberhobo
            I just noticed in Firefox 3.5.2 that setting `disabled = true` for a focused text input seems to make it impossible to re-focus after setting `disabled = false`. The solution is to blur it before disabling.
        
        
        
            0 
        
        
            1820 
        
                    posted 16 years ago by cyberhobo
            Usually use in a template with `in_category()`, like `if ( in_category( 3 ) || in_subcategory( 3 ) ) { ...`. Tested in WP 2.8.4.
        
        
        
            1 
        
        
            1415 
        
                    posted 16 years ago by cyberhobo
            Sometimes I want simple tabs without all the packaging of jQuery UI with a theme. This does the job with just jQuery 1.2.6, and should work with later versions.
        
        
        
            3 
        
        
            1512 
        
                    posted 16 years ago by cyberhobo
            Get the ID of the root (oldest ancestor, parent without parents) page relative to the current page in a WordPress page template.
Can be helpful for use with wp\_list\_pages() to create navigation markup.
        
        
        
            1 
        
        
            1596 
        
                    posted 16 years ago by cyberhobo
            Select the first and last item in an unordered list. As an example, I add a CSS class to each.
In WordPress, it's not so easy to get wp\_list\_pages() to generate these classes. jQuery provides an easy out for javascript-enabled clients.
        
        
        
            0 
        
        
            1539 
        
                    posted 16 years ago by cyberhobo
            There's no has\_children() function in WP 2.8.4, but get\_children() returns false if the post/page has no children, so it can serve the same purpose in a page template. 
Outside a page template you'd have to add a global declaration for the $post...
        
        
        
            2 
        
        
            1527 
        
                    posted 16 years ago by cyberhobo