Articles of theme development

How can I display a menu on certain pages only?

Instead of using sidebar widgets to tell on what page they should be visible, I like to choose at the menu settings to appear on specific pages. Default WordPress way: So projects is a page and has some subpages. But what if I have like 10 more of these pages and subpages with the same […]

Display Search Result Count

Until now I have been using below code to get the number of results when someone searches and to display that count. <?php /* Search Count */ $allsearch =& new WP_Query(“s=$s&showposts=-1”); $count = $allsearch->post_count; echo $count . ‘ ‘; wp_reset_query(); ?> But this does not seem like valid code. It shows below error: Deprecated: Assigning […]

Why is wp_head() creating a top margin at the top of my theme header?

I am creating a custom theme, and elements behave as they should but when I place the <?php wp_head() ?> tag I get a top margin, at the top of my theme header. When I remove the <?php wp_head(); ?> the margin goes away. I have been at this for a while any help would […]

WordPress Themes and PHP unit

Is there any examples of using PHP unit tests with WordPress themes, seems a lot of blogs out there on the subject are out dated as the core unit tests are apart of trac, yet last night – I pulled trac and tried to set up a sample theme to run tests on. It doesn’t […]

Is it possible to stop selected plugins from loading on certain template pages?

I have a template page that has form on that is only used once in my site. The form uses form validation using jquery validate plugin (such a great plugin). Once the cart66 Plugin is loaded, the form validation stops working. Rather spending ages looking for the conflict, I thought it would be easiest to […]

How to set permalink structure via functions.php

I’m setting up a WordPress Network and wanted all new sites to have the same permalink structure (i.e. “/%year%/%monthnum%/%postname%/”). I’m wondering if this is possible to do via hooks or hacks in functions.php, without having to rely on users to choose that structure.

CSS classes for theme

Does anybody know predefined (suggested by WP) CSS classes which should I use in my theme? I have seen somewhere in Internet a list of all CSS classes, which are used in WP theme, but can’t find it. UPDATE: I have found the site where I’ve seen this list: http://www.wpbeginner.com/wp-themes/default-wordpress-generated-css-cheat-sheet-for-beginners/

How do I add settings to the Background Options Page?

I am developing a theme and I wanted to add some extra content to the built in background options page. I know how to use the settings API to create new theme options and settings but I can’t seem to figure out where it’s actually calling to the background page. I have searched through wp-includes/theme.php […]

How to store widget fields data as an array?

I am creating a widget, it needs to store about 10 IDs. Right now I’m using following field method to store each of the ID in a separate field. It stores data of each field in a separately in the wordpress. Is it possible to store the data of all fields in just one row […]

How to display value of custom fields in page

I have a custom post type called ‘software’, contained within are various custom fields such as subtitle, price, screenshots, download link, etc. I created a function to allow use of the tinyMCE edit window for some of these custom fields. I have been trying to display these fields on the page but with no success. […]