Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Ok, I am pretty new to wordpress, and I have been reading a lot of the documentation online and testing things out on my own blog. I have just run into a couple of general questions.

At first glance for a newb editing the PHP is a little over-whelming. Different themes have different files. There is a whole list of functions that I need to get used to. I started to fret because I wasn't sure where to start if I wanted to make simple tweaks to a post, a page etc.

I have been reading a lot of the documentation of how Wordpress is structured and how wordpress posts get populated, so I'm starting to understand a little better, but I still have a question.

I have tried installing a few plugins and some cases I noticed that after I switched themes, the plugin didn't work. In cases like that, do I need to edit the PHP files of the theme to make the plugin work? Or am I missing settings somewhere.

Any assistance or explanation would be greatly appreciated.

share|improve this question
    
Hey thanks for the responses, I appreciate it very much –  kdub Jun 28 '11 at 15:01
add comment

2 Answers 2

A plugin in WP is a concept more related to user friendly packaging of code, rather than mechanics of code itself.

I don't want to overly confuse you, but in practice plugin can act like a theme and theme can perform functions common to plugins. Just be aware that these things are more about semantics then code.

When dealing with plugins that interact with theme output it's important to remember that only way they can accomplish that is by using hooks. Theme is strongly expected to make a number of generic function calls (such as wp_head() and wp_footer()) that set up important hooks and use template tags that come with hooks of their own.

So the most likely reason that plugin fails with specific theme is that theme is of poor quality or very outdated and doesn't provide hooks that plugin requires. There is no generic solutions to this - it entirely depends on specifics of concrete theme and plugins how/if they can be fixed to work together if they don't.

share|improve this answer
    
If one switches Themes, and a Plugin "stops working", I would say that, 99% of the time, the culprit is the Theme not providing appropriate hooks - usually through the omission of wp_head(), wp_footer(), or comment_form(). –  Chip Bennett Jun 28 '11 at 13:57
add comment

Switching themes can sometimes reset plugin and widget settings - which is one reason why the plugins would stop working when themes are switched. Second reason for a plugin not working is a poorly written theme that is missing wp_head(), or wp_foot() calls.

My recommendation for understanding WordPress better is to create your own dummy theme from scratch. Along the way you'll gain more understanding in a controlled, linear fashion.

See http://codex.wordpress.org/Theme_Development

There are many documents on the web describing how this is done, but, the one thing you should focus on is the simplest version.

  1. create a folder mytheme <- funny that it's a step
  2. create a file mytheme/style.css
  3. create a file mytheme/index.php

Just those two files can technically make wordpress work in its entirety, if the theme is coded properly [wp_head(), wp_foot() hooks, etc...].

If you start from a very, very simplified theme and start viewing content through it and different aspects of it - archives, categories, etc, you'll gain actual appreciation for specialized theme files.

A single index.php can get bloated and confusing (many if statements - such as is_home(), is_category(), etc, exception) which is why WP has a method to split off routines into individual files in a very structured and predictable manner.

Print this graph out: http://codex.wordpress.org/images/1/18/Template_Hierarchy.png

WP will basically check whether a specialized theme file exists (home.php, for example). If it does, it'll include it when needed. Otherwise, it'll default to a theme's index.php.

It gets a bit more complex from that point, but, I think that you typically can't understand the process unless you crawl along its evolutionary steps.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.