Skip to main content

Category: Code samples

Cropping Post Thumbnails from Top instead of Center in WordPress

Last week someone I know asked me how to do always a top center crop on thumbnails and I knew it was possible because of WP_Image_Editor. But you always wondered what it was before 3.5 and it always seemed you needed to hack code till I founded a post from George Stephanis. His post shows that […]

Read More

Adding post type support to the recent post widget

This feature is probably something that should be in core and the change is that a client already asked you for this feature. There are a lot of plugins on WordPress.org that do this and much more but this solution is clean since it still uses the WordPress widget. It only adds a selectbox to the […]

Read More

Getting the menu name of a theme location

For our code sample with starting with something simple. Sometimes you want to give the user the control to change the menu name in the template. Currently WordPress doesn’t have a function where you can pass the theme location but it’s quite simple to do with a few lines of code. It’s using two WordPress […]

Read More