Skip to content
This repository has been archived by the owner on Apr 21, 2021. It is now read-only.

Evolution of WPized Light #12

Merged
merged 11 commits into from
Oct 8, 2015
Merged

Evolution of WPized Light #12

merged 11 commits into from
Oct 8, 2015

Conversation

macieklamberski
Copy link
Contributor

Hey dudes!

For a long time, I wanted to do something about our base theme. Every time I start a new WP project I repeat the same actions to clean things a little bit.

  • First and foremost, I'm removing all non-essential templates (like comments.php, archive.php, etc.) This is because 99% of projects don't need them. I also don't use default markup that is present in the theme, as front-end is usually created first and then integrated into WP.
  • Then, clean functions.php as it has many unnecessarily defined post types, menus etc. I know it's there as an example, but I'll get back to this later.

I think we should have different strategy. WPized Light should be set of useful functions to start working on a real theme, not fully-working theme itself. I would rather prepare set of coding standards than bloat the theme with, in majority of the time, unnecessary files. Below is my take on this. It's more of an evolution than revolution (at least for now). I'm of course open for a discussion as many of the things I'll be presenting may be very subjective to my personal taste and projects I'm working on. If you have something to add or any comment, please refer to below matters by their number so we all have clear understanding of what you're referring to.

Below sections only talk about major changes that I've made. For more smaller tweaks please look at list of commits in this pull request. Pull request is created for develop branch, because I think it would be good to do changes here first and then if we have some stable version of new theme - move it to master and use officially.

1. Remove definitions of example custom content

Clarification: If you go to my take on functions.php, you'll see that I have moved all example usage of each built-in feature to the comment above it. The comment serves as a short documentation for each of features. This way, you immediately see how to use it and what it exactly do. I really like this approach because this way all the projects will have very similar functions.php file and all developers will feel like home in every project.

Explanation: I really like the approach for adding custom theme features with add_theme_support. BUT! When I start working on a new project, I don't want to have to remove all declarations example of menus, custom post types, taxonomies etc. If my theme requires to add CPT or menu, I just go to functions.php and add it. If my theme does not require any custom content - I should not have to go to functions and delete examples. I want to have only default WP content initially.

2. Remove all non-essential templates

Clarification: By non-essential templates I mean things like comments.php, archive.php, search.php etc.

Explanation: Have already touched this matter at the beginning but I will repeat: This is because 99% of projects don't need them. They also don't use default markup that is present in the theme, as front-end is usually created first and then integrated into WP. For this reason the content of these files replaced after all so I don't see the point of having them. And if majority of projects don't use them at all, why do I have to strain and delete them manually? It's the same situation as in point 1.

3. Move loading features to separate file

Clarification: Check out this file in /features to see what I'm talking about.

Explanation: This function for loading features is the same for all the projects so it's good idea to have it untouched in /features folder (just like features themselves). It just has to required in functions.php (it is by default).

4. Remove options feature

Explanation: I don't see a point of having custom options framework in the theme, as everyone is using ACF. We have license for ACF Options Page Add On, so I don't think there's much to add.

5. Remove comments-related features

I thought that they're not needed till I found today's issue #11. But still, does anyone use them?

@piotrkulpinski
Copy link

I don't have to much experience with WPized but I agree with those changes presented by @lamberski
Also, I totally agree that keeping code snippets directly in the functions.php is not the best idea and it's just unnecessary clutter. We should keep the examples in project's Readme file only.

@gicolek
Copy link
Contributor

gicolek commented Oct 6, 2015

I really like the improvements and I agree with all of the points. I had the same problem - the features to be removed instead of the features to be added. This improves the clarity and standardizes WPized Light a lot!

The only real problem is with the comments, which are actually used in case of disqus and rarely, but still with some CODEIzed projects. Hence their removal is not the perfect idea. They should be used as a theme feature. We could think of a very simple markup that could be incorported by the Front End dev to avoid the hassle of Back End tweaks. As you may know the comments are not that easy to tweak due to unusual approach of their HTML generation - there's no total control.

@gicolek gicolek mentioned this pull request Oct 6, 2015
@gicolek
Copy link
Contributor

gicolek commented Oct 6, 2015

Next, the sidebar.php file is required by the WordPress core so it should be brought back, can you take a look into it?

THIS IS NOT A VALID COMMENT.

@gicolek
Copy link
Contributor

gicolek commented Oct 6, 2015

Finally we could improve the feature loading. What you're doing now is loading each feature based on the support format, which forces .php to load the corresponding file. This happens even if the feature was empty, which affects the performance negativelly. A small tweak to the file could improve the issue: https://github.com/lamberski/wpized-light/blob/master/features/load.php.

@gicolek
Copy link
Contributor

gicolek commented Oct 6, 2015

Finally all of the theme subdirectories should contain an empty index.php file to avoid attacks on a servers listing the contents of a directory lacking the index.php file

@luboskmetko
Copy link
Member

Nice job, Maciek!

So no Timber for now?

@macieklamberski macieklamberski merged commit 4d01ca0 into xfiveco:develop Oct 8, 2015
@macieklamberski
Copy link
Contributor Author

Guys, I have merged this pull request to develp branch.

@luboskmetko I currently don't have much time to work on WPized, but will definitely continue to improve it. Twig template engine is also planned. :)

@gicolek I have reverted Comments and Threaded Comments feature to the theme. It's already on develop branch. Regarding other things you've mentioned, I'll look into this.

@gicolek
Copy link
Contributor

gicolek commented Oct 8, 2015

@lamberski great! Regarding the server safety related tasks all theme subdirectories should have the index.php file actually!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants