That’s because you shouldn’t edit core files.
Thread Starter
tameem
(@tameem)
esmi, I appreciate your reply and yes I have heard that also. But for those of us who wish to customize and clean up unnecessary or extraneous code in our pages, I would think there is an approach that would allow us do it? ‘Im a purist when it comes to markup and it would be great to do this.
An approach that would allow you to change whatever core files you want and then protect those customisations during an upgrade whilst still working post-upgrade and adding new functionality? I’d love to find an open source application that could do this.
And FWIW, I’m a coding purist and standardista but I’ve never found any code bloat that is so significant that I felt I had to edit the core files. If you want to get involved in core development and submitting patches, then I’d say “Go for it!”. Change the core code from the inside – not by hacking it unless you are happy to accept that your changes will be over-written by each upgrade.
Thread Starter
tameem
(@tameem)
I assure you my friend, when your dealing with extra div’s that can contribute to slower rendering. when you have code like this:
<div><p>next_link() prev_link()</p></div> instead of <p>next_link() prev_link()</p> and many other such code, it can make a difference. There are many other examples I could give you. Ive studied a great deal in HTML and CSS, and I think that’s area that is lacking with many WP theme developers. You can quickly tell when you inspect the theme’s CSS file. I do appreciate your reply.
I think that’s area that is lacking with many WP theme developers
Really? For my own part, I’ve been developing sites professionally for ten years and was hand coding sites when HTML 4 was first released.
What you describe is a theme issue – not a core file issue. The simplest and easiest way to deal with this is to create your own themes.
Thread Starter
tameem
(@tameem)
Yea Im sure you are right about developing my own theme. That’s what Im trying to do, but I dont pretend to be expert in PHP, Im still learning that. I just have such a hard time with all that extra crap in my pages. That over-zealous behavior on my part and concerned about little details has caused such a delay in developing my web site!
Thanks for your reply. I may have to bite the bullet here!
Theme files aren’t core files, so you’re free to amend as many template files as you see fit providing you don’t ever upgrade the theme. Creating a child theme offers the same flexibility but with the added benefit that your customisations are protected even if you upgrade the parent theme.
classes.php and post-template.php, however, are core files. Leave them alone to do their own thing and just focus on modifying the page output. Not only is this wiser but it’s safer from a security aspect too.
If you intend to start with theme development, pick a simple theme that offers the basic layout that you want and create a child theme. Go through the parent template files one at a time – adding your modified versions to the child – until you have the source markup that you want. After a while, you’ll have learnt enough about theme functionality that you’ll be ready to create your own parent themes from scratch.
Thread Starter
tameem
(@tameem)
esmi, yes thats what I meant. core files being classes.php, function.php, etc. All those files in wp-includes, etc. Good point about it being safer. Just to clarify, the only changes I make are markup type changes, output, like classes, divs, or use another element for example. Ill swap for example an em tag for p tag where appropriate. Or add a p tag and remove the div tag. And I have heavily changed the template files, yes. But for example when you add another link for your navigation, it will add a classes to each list item (wp_list_pages). Ideally i love for it to just be:
<ul>
<li>Home</li>
<li class="current>About</li>
<li>Contact</li>
</ul>
But im sure you know what i mean. Thanks so much for your replies. I appreciate it.
I agree that your example markup is much cleaner and, if I was hand coding, I might do the same. But WP has to be all things to many people. wp_list_pages, for example, is used in all sorts of different contexts and developers need the hooks to be able to use CSS effectively in multiple situations.
Earlier today, I was able to use the page specific class that wp_list_pages generates to enable one user to change the color & font-weight on just 1 specific link in a nav menu. If those multiple classes weren’t built into the wp_list_pages core functionality, these kinds of display changes just wouldn’t be possible without some heavy-duty re-coding.
I hate seeing markup that’s suffering from a major attack of “divitis” and I do think that some themes suffer from this – perhaps because their authors weren’t able to target CSS effectively without adding classes to everything. It’s probably the main reason why I started creating my own themes 5 years ago. But with a few possible exceptions, I think the markup produced by core is pretty lean when you take the “all things to many people” into account.
Thread Starter
tameem
(@tameem)
esmi, agreed. Actually when I first started to use WordPress I was pleasantly surprised by the semantic, generally well-written markup! And to be sure, it is MUCH better then most CMS programs out there and I prefer WordPress. And I do understand about the possible need for the additional markup, particularly classes.
Although, I think we can agree that in most cases, I cannot see where additional divs is necessary in most cases, with possible exceptions due to presentational requirements. Gosh, I hate seeing a div added when there is already a block-level element that can be used as a styling hook! So I tend to be less, well, tolerant personally when I see additional divs rather then classitis. Basically I would agree with your statement about multiple classes though and it makes sense. Thanks for your reply.