Articles of theme development

Child themes: disabling the parent

I’m creating a parent theme and several child themes. But how can I prevent the parent theme from ever being used?

.sub-menu or .children?

I’m developing a theme using a test installation (using InstantWP), but when I upload it to a staging site, for some reason the nav menu looks inflated. After looking at the source, it turned out to be that for some reason my test install uses the class .sub-menu while the staging install uses .children. Both […]

Weekly background code not working

I have this code I want to implement onto my website. I have successfully set up a child theme. This code is suppose to change the background every day of the week. I am not all too familiar with WordPress, and I am wondering where I should place it and how. Can someone please give […]

Finding the paragraphs in content

I am trying to create two functions, one that catches the first paragraph of some content, and one that catches the rest, but I have hit a bit of a conundrum. I have this in my single.php: <div class=’the_content’> <?php the_content(); ?> </div> which produces: <div class=”the_content”> <p>The content …..</p> <p>The content …..</p> <p>The content […]

What's the difference between hooks, filters and actions?

This question already has an answer here: Difference Between Filter and Action Hooks? 3 answers

What is the best way to handle multiple calls to get_template_directory_uri() and similar functions?

Edit: Thanks for your replies, guys. This is exactly what I was after. You each brought up some good points. I think I’ll stick with using constants. This is really a best practices/performance question. I’m mainly concerned with the following functions: get_template_directory_uri() get_template_directory() get_stylesheet_directory_uri() get_stylesheet_directory() I’ve been under the impression that it is bad practice […]

How to add nofollow to wp_nav_menu

I need to add an option in my theme options panel to set a specific custom menu’s links all to nofollow. Does wp_nav_menu() allow this or does it require a custom walker to manually ad rel=”nofollow”?

Is Dreamweaver CS5 a serious choice for theme/plugin development?

I’ve heard that Dreamweaver has been improved significantly in latest versions. Does anyone have experience in developing a theme or plugin using Dreamweaver? What are the pros/cons? Thanks in advance

Context aware widgets. My work in progress

I’m working on a simple addition to the widget options to allow the user to set the “context” in which widgets show be shown. Here’s what I’ve got so far, with my questions in the comments… 1) Append the widget form to all widgets… add_filter(‘in_widget_form’, ‘wse_widget_context_form’); function wse_widget_context_form($widget){ //echo ‘the widget id is: ‘.$widget->id; //do […]

Can't edit style.css in subdirectory of my theme?

I want to edit a file style.css but the theme editor shows this: /* ———- Reset Tags ———– */ @import url(“css/reset.css”); /* ———- Reset Tags ———– */ @import url(“css/prettyPhoto.css”); /* ———- Shortcodes ———– */ @import url(“css/shortcodes.css”); /* ———- Site Styles ———- */ @import url(“css/style.css”); Is there any way to edit css/style.css via the Theme Editor?