Posted tagged ‘wordpress’

Views Output Formats – New WordPress plugin

18/11/2013

Image

Just released a new WordPress plugin:
Views Output Formats

It lets you export your WordPress data in XML and JSON formats easily, and integrates with the Toolset Views plugin.

New themes for WordPress Distraction Free Writing mode!

19/03/2013

A new version of Distraction Free Writing mode Themes plugin for WordPress is out!

Make sure to check out the plugin announcement in case you missed it.

Here are the new themes:

Autolycus

autolycus

Sophisticated and clean theme with a monospaced font.

Based on Ulysses text editor.

ZenHub

zenhub

Calming dark blue hues. Perfect for writing into the small hours of the night.

Based on the dark Zen Writing mode on GitHub.

Make your own themes!

Use the Custom setting to write your own theme! If you’ve made a nice theme – create a topic in the support forum to have it included in an upcoming version!

Other changes in this version

Compatibility with other plugins is improved by applying some !important overrides.

Upcoming features

Next version will see a Gallery-like mode for selecting your theme, so that you can get a better glance at all the themes at once.

A long-term goal is the ability to create your own theme using color pickers, as well as the ability of saving multiple custom themes.

Until next time:

Click here to see more themes!

Download Distraction Free Writing Mode themes plugin for WordPress

Common use snippets for Widget Logic

17/07/2012

Widget Logic is a WordPress plugin that that gives every widget an extra control field called “Widget logic” that lets you control the pages that the widget will appear on. The text field lets you use WP’s Conditional Tags, or any general PHP code.

I’ve been using Widget Logic in my WordPress projects for a while now – it’s clean, versatile and I highly recommend it.

Below are some snippets that you will likely find useful when you are building a new site.

Show widget only on specific pages or posts

This example displays the widget only on the page that has the slug example-page

is_page('example-slug')

This is my favourite way of specifying widgets for certain pages, as it works in a similar fashion to how you configure blocks for specific paths in Drupal.

This example displays the widget on pages with ID 1 and 5.

is_page(array(1,5))

is_page() is very flexible and can take id’s, page names, slugs and even arrays with multiple values – see the documentation.

But what about blog posts and attachments?

Use is_single()  instead – see the documentation.

Here is an example that display the widget when the user is visiting a post with the title “About this blog”

is_single('About this blog')

Show widget everywhere except a specific page or post.

This is the inverse of the previous examples, so the first example would be:

!is_page('example-slug')

Note the exclamation point, which inverts the logic.

The second example would be:

!is_page(array(1,5))

Show widget only on front page

Handy for front page-specific summary widgets, calendars, introductions etc.

is_front_page()

Show widget only for a specific post type

An easy way to display widgets for certain post types.

get_post_type()=='post'

Some common post types

  • page
  • post
  • attachment

Show widget based on a WPML language

If you are running a site using the WordPress Multilingual Plugin (WPML) you can use this snippet to only show a widget when the user is viewing the page in a certain language (English in this case)

(ICL_LANGUAGE_CODE == 'en')

There are more useful constants and functions available in the WPML manual.

Combining multiple rules

It’s easy to combine multiple rules with regular PHP logic. This example will display the widget only when the user is viewing a site in Swedish (WPML) and is on the pages with ID 1 or 5:

(ICL_LANGUAGE_CODE == 'sv') && is_page(array(1,5))

Don’t forget you can also use the || (or) operator!

More useful tags

I recommend reading the WordPress documentation on Conditional Tags to customize Widget Logic for your exact needs.

Feedback!

Do you have a useful snippets for Widget Logic? Feel free to post it in the comments!

Twenty Eleven Sidebar WordPress theme announcement

17/06/2012

Just put up the project page for my Twenty Eleven Sidebar WordPress theme!

Twentyeleven Sidebar is a Twenty Eleven child theme with a persistent sidebar, which means you will see the sidebar on individual posts, pages as well as media pages, such as for images.

Check out the project page, or get the code from Bitbucket!