Category Archives: Tips & Tricks

WordPress get_the_content function no paragraph tags

Did you just use the WordPress get_the_content function and realize that all of the line breaks from the visual editor are not being returned as paragraph tags? Solution: Apply the appropriate filters as outlined in the WordPress codex… <?php $content … Continue reading

Posted in Tips & Tricks, Wordpress | 2 Comments

Get current index position in loop in WordPress

Need to get the current index position while iterating through a WordPress loop? Simple… just use $wp_query->current_post Here’s a very stripped down example loop. Note the output starts at 0 (ie 0, 1, 2, 3…) <?php while (have_posts()) : the_post(); … Continue reading

Posted in Tips & Tricks, Wordpress | 1 Comment

Get image path in child theme in WordPress

To get an image path (or any other file for that matter) inside your child theme in WordPress you can use the get_bloginfo function with the “stylesheet_directory” parameter. <img src="<?php echo get_bloginfo(‘stylesheet_directory’); ?>/yourpath/to/an/imagefile.jpg" id="my-new-image" alt="My New Image" />

Posted in Tips & Tricks, Wordpress | Leave a comment

Remove “comments are closed” from a WordPress theme

On a client’s site, needed to remove “comments are closed” from post/pages where comments have been manually disallowed (by the client on the bottom of the edit screen). Most blogs say just to remove the call to <?php comments_template(); ?> … Continue reading

Posted in Tips & Tricks, Wordpress | 2 Comments

Add Description Field To Images In WordPress

When adding an image via the default WordPress image uploader, one option among many is the ability to define a description…. Interestingly enough, when embedding the image inside of a post, the description field unlike the caption field does not … Continue reading

Posted in Tips & Tricks, Wordpress | 5 Comments

How To Get Text From Textarea using jQuery With .val() method

Recently, was doing some form validation and needed to quickly grab the text content from a textarea input using jQuery. Tried using the “.text()” method to no avail. A little hunting and found out that what I was actually looking … Continue reading

Posted in jQuery, Tips & Tricks | 1 Comment

How To Highlight Current Category In WordPress Menu (wp_nav_menu) For Single Post Pages Using jQuery

UPDATE 10-11-2010: This information below is dated. The easiest way to accomplish this is to now just use built in classes outputted by WordPress (ie .current-post-parent). Please see this post for more information. The new menu manager in WordPress 3.0+ … Continue reading

Posted in jQuery, Tips & Tricks, Wordpress | 3 Comments

How To Add Custom Styles To The WordPress Editor Dropdown

I was searching for a simple way to add my own custom classes to the WordPress 3.0 editor styles/format dropdown (Paragraph, Address, H1, H2, H3 etc etc). This is a great easy way for clients who can’t / won’t go … Continue reading

Posted in Tips & Tricks, Wordpress | 13 Comments

How To Get Top Parent Page ID In WordPress

Often when working with pages in WordPress you’ll need to get the ID of the very top parent in a hierarchy of pages. This could be useful for many reasons, but I run into the need most often when I … Continue reading

Posted in Tips & Tricks, Wordpress | 8 Comments

Easy Breadcrumbs In WordPress

When creating the page section of a client site in WordPress, the need for breadcrumb navigation often arises.  There are probably multiple methods/plugins that can do this, but the one I use is “Fold Page List“. Fold Page List, is … Continue reading

Posted in Tips & Tricks | Leave a comment