So you implemented Jetpack’s Infinite Scroll feature in your theme, but you don’t want it in a particular page, say a category archive page. Here’s the code you need to add to your theme’s functions.php file:
In a recent project, I needed to use <span /> tags to add some styles (just color, actually) to post and widget titles. By default — and there’s no hook to disable this — WordPress strips any HTML tags found in post and widget titles. Here’s my solution to this problem.
Term list table, unlike post list table, is not very customizable. What I needed was to display the thumbnail/icon of each term, to make it easier for the content editors to distinguish one term from another.
By now you’re probably already familiar with one of WordPress’ most loved features, custom post type. A custom post type could be hierarchical (like page) or non-hierarchical (like post). This snippet will modify the default posts order when the post type archive is being displayed.
By default, WordPress will prefix protected post’s title with Protected. This is good when the password hasn’t been supplied. Unfortunately, it doesn’t remove this prefix when the correct password has been supplied which is not good IMO. Here’s a snippet to ‘fix’ this behavior:
Since version 2.9, WordPress provided a new function, add_image_size() to define additional image sizes along with the three default sizes: Thumbnail, Medium and Large. After defining the additional sizes, we can use them in our themes either using the_post_thumbnail(), wp_get_attachment_image(), or any other functions that suit your needs.
In WordPress, we can set multiple categories/terms for a post. This is true for both hierarchical taxonomies (ex: category) and non-hierarchical taxonomies (ex: post_tag). However, on a project I’ve worked on, the client wanted me to make the category metabox to use radio inputs (exactly like WordPress’ new post format feature) instead of checkboxes to […]
The Problem We need to add our custom class(es) to the posts navigation links to be able to add some styles. The Solution Use the available next_posts_link_attributes and previous_posts_link_attributes hooks. How? Open your theme’s function.php file and add these lines (must be inside the <?php ?> tag): add_filter( ‘next_posts_link_attributes’, ‘kc_next_post_link_attr’ ); add_filter( ‘previous_posts_link_attributes’, ‘kc_prev_post_link_attr’ ); […]