Articles of theme development

Override Current Theme Setting in wp_config.php

I am looking for a way to override the currently selected theme, preferably from within the wp_config.php file. I know you can override some wp_options settings in the config like define(‘WP_HOME’, ‘http://someotherdomain.com’); This will override the ‘home’ option in the wp_options table. There is an option called ‘current_theme’ that stores the name of the currently […]

How to add categories to wp_list_pages()

What (if any) is the hook or method for including named categories into the wp_list_pages function? The end result would be that the categories are added onto the end of the list of pages (along with any child categories that exist, with proper ul/li nesting for drop down css to act on)… Home | About […]

Theme change only in CSS and a few images

We created a theme that has a lot of changes in it. Now we want to enable that theme on our site in different colors, and a few images different: What we’re doing is duplicating the theme, and then making a few changes in the CSS, and change a few images. But it seems an […]

Am I supposed to create a child theme for every theme I use?

I just learned about child themes recently and was wondering if creating a child theme for every theme I create is necessary. I just find it weird how other themes work okay without child themes, and others do not.

How can I exclude specific authors from wp_list_authors

I want to have the authors listed like usual from wp_list_authors() but I know there are a couple of ones I would like to exclude from the list as well. Is there a way to do that? Thanks

Is there a theme function for is_password_protected()?

I’m looking at the function and template references and I’m not seeing a way to test for whether a post is protected. Is there a theme function for (something like) is_password_protected()? I’m already using add_filter( ‘the_password_form’, ‘custom_password_form’ ); to override the default form that shows up, but I want to customize some other aspects of […]

Style.css redirects to 404 Page not found

I’ve just uploaded a wordpress site from MAMP to a live site. Exactly the same methods I usually use to upload them, including permalinks and all the usual PHPMyAdmin bits. This time the style.css, js and all the images are just redirecting to a 404 page. The website is here Can anyone help? This makes […]

Why WordPress architecture is not pure object oriented and it don't use MVC pattern?

I am pretty new in WordPress and PHP development (I came from Java and C#) and I am a bit astonished about how WP is structured. Coming from Java and C# I’m used to work on totally object oriented architectures and now, working on WP, it seems to me that it is not totaly object […]

Unwanted blank lines before <html> tag

I’ve a strange problem with an Autofocus theme. In my templates file, header.php, I’ve a code like this (and is correct) <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”> <html xmlns=”http://www.w3.org/1999/xhtml”> When I look at the source code of the generated HTML, I found something like this [blank] [blank] <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 […]

How to display the content for given page ID withot the <p></p> wrapper?

How to display the content for given page ID withot the <p></p> wrapper? The method I’m currently using is: <?php $id=21; $post = get_page($id); $content = apply_filters(‘the_content’, $post->post_content); echo $content; ?> For example page ID = 21 has the following content: Some content What the wordpress echo is <p>Some content</p> Any suggestion much appreciated.