Tag: wordpress

Jquery noconflict

In WordPress, jquery is configured not to define the $ variable since it may conflict with other libraries.
You are therefore encouraged to use jQuery(document).ready(…

But we are all creatures of habit and thus may prefer to use $. So simply add this line at the top of your js file / script tag

if (typeof($) == ‘undefined’) $ = jQuery.noConflict(); // added by Imran@cselian.com to use in wordpress

wp: load posts in wp_list_categories

I believe a sitemap should show posts under categories, and maintain the category hierarchy.

wp_list_categories cannot be asked to include posts.
And if you follow this suggestion and try and use get_posts, you will get a nasty surprise; it will get all posts in all sub categories of the one you want. and this WILL NOT DO!

I found that you need this query and that you can inherit the category walker and pass that to the wp_list_categories method. Am impressed! Read more »

wordpress theme – featured posts

PS

I’m modifying the wordpress plugin to include a custom Ordering and expose a method cs_get_featured_posts which wraps query_posts for use directly in a theme. I need this for letting the theme customize the results instead of simply using the widget provided in the original. Browse source.

Changelog

  • Add featuredOrder to the add_featured method.
  • add cs_get_featured_posts method.
  • hook the query_posts to include custom joins and order by to make it more readable than trying to pass all as parameters.

To Arrive at this, I had to try WP_DEBUG and realised that the suggested get_meta_sql doesnt work by looking at query.php. Read more »