SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Enthusiast murphaloid's Avatar
    Join Date
    Oct 2011
    Posts
    54
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    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:

    http://www.onextrapixel.com/2011/03/...-from-scratch/

    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!

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,199
    Mentioned
    456 Post(s)
    Tagged
    8 Thread(s)
    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?)

  3. #3
    SitePoint Member
    Join Date
    Jul 2012
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not directly related to your question, but I'd recommend checking out both Nettuts and 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

  4. #4
    SitePoint Enthusiast murphaloid's Avatar
    Join Date
    Oct 2011
    Posts
    54
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    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?)
    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!

  5. #5
    SitePoint Enthusiast murphaloid's Avatar
    Join Date
    Oct 2011
    Posts
    54
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by iainjames88 View Post
    Not directly related to your question, but I'd recommend checking out both Nettuts and 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
    Thanks for the tips there...will definitely check them out

  6. #6
    Mazel tov! bronze trophy kohoutek's Avatar
    Join Date
    Aug 2004
    Location
    Hamburg, Germany
    Posts
    4,248
    Mentioned
    30 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by murphaloid View Post
    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!
    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.
    Maleika E. A. | Rockatee | Twitter | Dribbble



  7. #7
    SitePoint Enthusiast murphaloid's Avatar
    Join Date
    Oct 2011
    Posts
    54
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by kohoutek View Post
    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?

  8. #8
    Mazel tov! bronze trophy kohoutek's Avatar
    Join Date
    Aug 2004
    Location
    Hamburg, Germany
    Posts
    4,248
    Mentioned
    30 Post(s)
    Tagged
    0 Thread(s)
    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/expres...gine-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...hp?scriptid=86
    Drupal: http://www.opensourcecms.com/scripts...p?scriptid=191
    Silverstripe: http://ss3.demo.silverstripe.org/
    Maleika E. A. | Rockatee | Twitter | Dribbble



  9. #9
    SitePoint Enthusiast murphaloid's Avatar
    Join Date
    Oct 2011
    Posts
    54
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by kohoutek View Post
    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/expres...gine-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...hp?scriptid=86
    Drupal: http://www.opensourcecms.com/scripts...p?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

  10. #10
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,199
    Mentioned
    456 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by kohoutek View Post
    And here are demos you can try out for each of the above:

    ExpressionEngine: http://webunder.com.au/weblog/expres...gine-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...hp?scriptid=86
    Drupal: http://www.opensourcecms.com/scripts...p?scriptid=191
    Silverstripe: http://ss3.demo.silverstripe.org/
    That's a great list of demo sites, Maleika.

  11. #11
    SitePoint Enthusiast
    Join Date
    Dec 2011
    Location
    Northern Ireland
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  12. #12
    SitePoint Member
    Join Date
    Oct 2012
    Location
    Atascocita, Texas, United States
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •