Basic Wordpress - struggling to understand it!

Ive recently been trying really hard to get my head around Wordpress, but so far Ive had several false starts. I think Im being quite dumb and theres some fundamental concepts Im just not getting and I’ve been banging my head against the wall for too long! So I thought Id come to you guys for help. Ive gone through so many tutorials and tried to read around it but getting totally lost!

Im still quite new to web development, teaching myself. Have a good basic grounding in html/css and I’ve made a start with php recently.

The best way to explain my problem is to lok at the tutorial Ive just been following, to build my own basic custom theme. You can find it here:

The tutorial provides all the basic code needed to build a simple theme template. Im tinkering around with it. When I go into style.css to edit some styles, I notice various class selectors for the navigation (‘.nav’ for example). The I realise…where did the class name come from? I cant find any mark-up in any of the php files that contain any html with the “class=nav” in them for the main navigation. I can find a ‘navigation’ class in the index.php file, but nowhere a .nav.

I dont like altering my css without seeing the markup its relating to! Please tell me what Im missing/not understanding.

Thanks!

Ultimately, if there’s no class=“nav” in the HTML, then any styles that target this in the style sheet are useless. If you look at the final HTML that’s output to the browser, do you see a class=“nav” anywhere? (That is, when you View Source?)

Not directly related to your question, but I’d recommend checking out both Nettuts and [URL=“http://themeforest.net”]ThemeForest for articles on creating WP themes from scratch.

Also, using a WP boiler plate like Bones might help you out (it’s a bare bones WP theme you can build on).

Happy coding :slight_smile:

Thanks for the response. OK Ive done some more digging around and finally discovered that the ‘nav’ class is set in the ‘wp_nav_menu’ function. I dont really understand it yet but I think thats whats going on!

Thanks for the tips there…will definitely check them out :slight_smile:

You’ve detected one of the bad coding practices of WordPress which seems to be the root of your confusion. WordPress has many functions with hard-coded markup contained within those functions, which is a horrible practice, highly inflexible, and one of the reasons why so many themes have crappy markup.
The best thing would be to remove all of that extraneous markup with filters which, unfortunately, isn’t always a straight-forward process.

You’ll stumble across this issue quite a few more times while creating your theme.

I see, interesting to know that, thanks. Im aware of a few other CMS platforms, but is there another you would personally recommend that is free and doesn’t have too steep a learning curve?

WordPress is still a good piece of software, so I’m in no way recommending against using it. Just be aware that many of the functions output markup and that you’ll have to filter them out. WP has some functions that allow you to do that, though it’s not always a simple process, I find.

My favorite CMS is ExpressionEngine. It is commercial, however, but you have 99.9% control of all your markup and don’t need to touch a single line of PHP unless you’d like to get really advanced and do something that either isn’t built into the system already or isn’t provided by a third-party add-on. It’s not inexpensive but you get a lot for your money.

Two other really great ones that give you more than 99% control are Perch (commercial) and Statamic (commercial).

There are two left that I recommend. The first being MODx Revolution. There is a learning curve, however, but well worth investing into. It’s open-source, so doesn’t cost you anything except time and effort.

And finally, if you want a really simple open-source CMS, I can recommend Textpattern. It’s a very sophisticated little CMS. It’s clean, lightweight, logical, simple, conscise, and user-friendly.

Frankly, it is not as popular as any of the others I mentioned above, but that has nothing to do with its quality. Textpattern is a quiet contender and there are quite a few professionals using it for their own sites. I used it when I started out and only moved away from it because I found ExpressionEngine and liked that even more.

For basic stuff, like a blog or magazine, Textpattern is perfectly apt. For more complex sites, you might want to try something else, however.

I should also mention Drupal and Silverstripe as they seem very popular and get recommend a lot as well, though I can’t say anything about them as it’s been years since I last worked with Drupal and I’ve never even tried Silverstripe.

And here are demos you can try out for each of the above:

ExpressionEngine: http://webunder.com.au/weblog/expressionengine-2.1-demo/
Perch: https://grabaperch.com/demo
Statamic: Doesn’t have a demo but a few videos that show you what it’s like working with it: http://statamic.com/learn/screencasts
MODx: http://www.trymodx.com/
Textpattern: http://www.opensourcecms.com/scripts/details.php?scriptid=86
Drupal: http://www.opensourcecms.com/scripts/details.php?scriptid=191
Silverstripe: http://ss3.demo.silverstripe.org/

Wow, thanks for such a thorough reply! Ive heard of some of those you suggest but never tried them. Great to have a few recommendations.

Thank you :slight_smile:

That’s a great list of demo sites, Maleika. :slight_smile:

Man the best tutorial ive read on theme development is chris spooners… just google “chris spooner wordpress theme”… i used to be really baffled by it too but its as simple as placing php tags in place of “content”, the title and the stylesheet location on the page after youve built it completely in html/css, zip it up and upload and bingo… that tut really helped me

I have to ask… If you are new to WordPress, is there a particular reason you’re trying to build a theme from scratch? There are a lot of great themes out there that you can use to create a customized design. I use one theme for all of the websites I build: Atahualpa. It has one of the most robust theme options systems available (more than 200 different options). You can style each element from within the options panels, and there’s also a CSS add-ins section where you can write a customized stylesheet. Of course it has its drawbacks and quirks, but one of the best things about it is the extremely active and helpful support staff at the forums. Juggledad, Larry, and Flynn are awesome. They have also recently developed a pure html5 / css3 theme called Montezuma that’s pretty awesome.