Use if statement found here that allows you to sort by the parent category, to show only relevant child categories on various landing pages:
Read MoreIf you’d like to continue using the_post_thumbnail in your theme, but do not want to use a fixed default, use this snippet to inherit images from parent pages.
Read MoreGenerate a list of WordPress posts, grouped by month, for the specified author.
This comes in handy when working with multiple authors, and needing to generate a list of archives for their content.
Read MoreAlternative: echo wpautop(get_field(‘featured_summary’));
Read MoreAdd the following code to your functions.php in order to redirect your home.php template to the most recent single post
Read MoreAdding increasing increments to loops can help with styling elements, and revealing additional content. Here are few examples to implement counters with php.
Read MoreAn alternative to wp_list_categories() – using get_categories() with a loop can prove to be quite useful in terms of customizing category displays.
Read MoreSometimes transitional content is used in one area of a website, like to display hours in a Header or Sidebar. Instead of having the client (or yourself!) update this content every day, get your code to update it for you when the weekdays change.
Read MoreUse this to grab the Featured Image from the post parent if the child page is not using a Feature Image.
Read MoreI have dug all over the internet for a query like this one!
This will generate the get_archives_link needed to link to your Custom Post Type year/month url.
Read MoreDrop the below if statement within a loop and add a count for each colour change that you need with the template.
This is a great example to reference if you’re building a scrolling website, and loading all pages in a single progression with alternating templates applied.
Read MoreRetrieve the ID of the first item in a loop:
$category = get_the_category(); echo $category[0]->cat_name;Read More
For use with older browser version testing.
Read MoreCreate a menu that drills down to subpages as they exist.
Read MoreCreate two functions within functions.php. One will control the “if(has)” parameter that will be called within the page template, and one will contain the data that we want to display:
Read MoreFollow these instructions to exclude custom post type category.
Read More$top_page_url = get_permalink( end( get_ancestors( get_the_ID(), 'page' ) ) );
Use the above text in place of the_permalink(); in order to retrieve the link information for the topmost page ancestor.
Read Moreecho apply_filters('the_content', get_post_field('post_content', $post_id));
Sourced here.
Update – July 28, 2015
This method can also be used to retrieve data from custom fields when working with plugins like Advanced Custom Fields:
echo apply_filters('widget_content', get_post_field('widget_content', $post->ID));
Read More
If page IDs or other classes are not appearing in the source code for a site that you’re working on, check the header.php file to see if body_class(); is being applied to the <body> tag.
Read MoreWorking with large sites that have cross-over content, sometimes it’s necessary to know how to bring multiple taxonomies into a single query.
Read MoreWhen creating parallax websites, or websites where all of the content is visible on one area, use the following to keep users from getting sidetracked from other areas of the website
Read MoreUsing large sliding banners with linked content can be both a blessing and a curse. This adds a beautiful level of style and information to the site, but also takes up a lot of space, and provides a lot of repetitive information that can be difficult for new visitors to navigate.
Read MoreUsing the_date(); this is very easy to achieve, all you need is © to get yourself setup. To take it a step further, you can include a date span, so your clients are aware of just how long you’ve been burning the midnight oil.
<p>© 2013 <?php date('Y') == "2012" ? $year = "" : $year = "- ".date('Y'); echo $year; ?></p>
Sourced here.
Read MorePlace this within the single.php template to grab the Featured Image and format it automatically inline with the content.
the_post_thumbnail('large', array('class' => 'alignright'));
This can also be used in the loop with alongside posts with featured images.
Read MoreMenus can be tricky. Rather than being locked into the just using menu sort order, or alphabetical order, combine the two using wp_list_pages(); You can style the drop downs to respond on hover using CSS.
Read MoreI’ve run into problems several times where exclude and include do not work, or work selectively, and as a result, either all of the posts are included, or none of them are. I’ve found an answer that works both inside and outside of the loop.
Read More