Like the blog? Get the book »

Posts tagged: functions

Archive page 3 of 4
WordPress Tip: Remove nofollow Attributes from Post Content

WordPress Tip: Remove nofollow Attributes from Post Content

If you have posts that include the nofollow attribute on links, you may at some point decide to remove them. By default, WordPress doesn’t insert nofollow attributes in post content, but there are a variety of plugins that will insert nofollow into all links in post content.

Or perhaps you have been manually adding nofollow tags to your post links for SEO purposes. Regardless of how they got there, it’s very easy to clean things up and remove all nofollow attributes from post content.

Rounded Font-Sizes (with Colors!) for Tag Clouds

Rounded Font-Sizes (with Colors!) for Tag Clouds

Tag clouds accomplish their varied font sizes by applying inline styling to each tag. The resulting font sizes can be really weird with values like font-size: 29.3947354754px;.

Of course, there is nothing inherently wrong about that, but it feels a bit unsettling and less controllable. Awesomely, Mike Summers sent in a solution he uses on his own site..

Leave Comments Open Forever on Specific Categories or Page Templates

Leave Comments Open Forever on Specific Categories or Page Templates

I like the idea of shutting off comments after a certain number of days. Here on Digging Into WordPress we do it after 90. After that kind of time, the “community” of the discussion is long over. I think a good practice for turning off comments is to instead leave a message informing visitors that the comment thread is closed, and offer a course of action in case they have something of grave importance to share. Here is an example from CSS-Tricks:

Custom Query Shortcode: Run a Loop inside Any Post/Page

Custom Query Shortcode: Run a Loop inside Any Post/Page

I had the occasion yesterday to have a page with a section on it where it would output a very specific set of other pages, which would need to change dynamically. What I could have done is built a special page template for this page, and inside that template run a query_posts() to get these posts. But I wanted this page to remain editable from the admin. Besides, creating a special page template every time you need to do something like this is too cumbersome. WordPress is extensible enough to do better.

Google Maps Shortcode

Google Maps Shortcode

David Hollander of SparkWeb Interactive sent us in a little code clip for inserting Google Maps into Posts/Pages by the use of shortcodes. Google actually has copy-and-pastable iframe code already in Google Maps that is really easy to snag, but David was having problems with the Visual text editor screwing up the code when saving the Post. With a short code, no problem.

How to Disable Comment Feeds for Individual Posts

How to Disable Comment Feeds for Individual Posts

By default, WordPress generates an RSS feed for the comments on every published post. Many sites take advantage of this by displaying a feed link next to the comments area. This enables visitors to subscribe to the comment thread and stay current with conversation. It’s convenient, simple, and super useful. For example, a typical feed menu for many blogs includes the following items:

Rude Things Plugins Can Do

Rude Things Plugins Can Do

I heart plugin authors. Their work is generally amazing, a huge benefit to the community, the reason why WordPress rules so much, and deserving of much worship. That being said, plugins can do some pretty rude things sometimes…

Easy Shortcode Permalinks

Easy Shortcode Permalinks

When you are building a theme, and the circumstance comes up where you need to create a link to a specific page hard-baked right into the theme, there is a function you should be using.

Precision Targeting with Custom Action Hooks

Precision Targeting with Custom Action Hooks

WordPress’ powerful action-hook system makes it possible to insert functionality at any point in your theme. Most WordPress themes include some of the built-in WordPress hooks by default. For example, most of us are aware of the two most common WordPress hooks: wp_head() and wp_footer(), which generally appear in the theme’s header and footer sections. These two hooks provide WordPress a location at which to execute various scripts and functions. For example, the wp_head() hook is where WordPress generates a variety of <link /> and <script></script> elements, among other things.

Global Custom Fields, Take Two

Global Custom Fields, Take Two

Just as I hoped, someone wrote in with a far nicer solution to my Global Custom Fields solution than I originally had. Big thanks to David Hollander for this.

Global Custom Fields

Global Custom Fields

Custom fields allow us to attach data to Posts or Pages that we can yank out and use at will in our templates. They are awesomely flexible and single-handedly allow WordPress to be used for about any CMS need. The fact that they can only be used on single Posts can be limiting in some circumstances. Sometimes you wish you could grab a custom value that you can control and is consistent globally, regardless of the current post. In this post we’ll look at a technique to do so.

Easy Custom Feeds in WordPress

Easy Custom Feeds in WordPress

Now that we have seen how to setup Tumblr-style posts, it would be nice to be able to segregate the Tumblr-posts category from the main feed into its own, separate feed. This would enable readers to subscribe exclusively to the Tumblr-posts feed and maybe display it in their sidebar or something.

How to Implement Tumblr-Style Links for Posts and Feeds

How to Implement Tumblr-Style Links for Posts and Feeds

Since posting the DiW tutorial on designing a Tumblelog theme for WordPress, several readers have asked for a tutorial on how to setup just the Tumblr/tumblelog-style post links …without having to implement the entire theme.

Advanced WordPress Targeting with body_class_plus()

Advanced WordPress Targeting with body_class_plus()

Since WordPress 2.8, we can target specific types of page views with CSS using the new body_class() tag. Designed for use within the <body></body> element, body_class() outputs various class attributes according to the current type of page view. This makes it easy to apply page-specific styling such as current-page navigation highlighting and other nifty CSS tricks.

© 2009–2024 Digging Into WordPress Powered by WordPress Monzilla Media shapeSpace