Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

Endlyss on "Any Possible problems with the following? Archive Template (Code Review)"

$
0
0

First off, I apologize if this ends up duplicating. I posted a post similar to this about an hour ago and it has yet to publish...I the looked around and realized that I should have used pastebin (which may be why it isn't publishing, because there was quite a bit of code in it :P

Anyways...
Hey guys...at the moment I am building a theme that I am going to try to provide for free to the community. I have been working with wordpress for the past year and a half now, but this is my first theme that will be distributed to many people, where I have to provide a lot of customization ability, so I am learning a lot as I go.

The blankslate theme that I downloaded did not offer as much as I would have preferred in terms of easy customization. Took a lot of hacking to get smaller things to do exactly what I wanted, and basically figured I would be better off doing it from scratch and just keeping the default functions that were bundled in the bare theme.

Problem is that I am not quite sure if my substitution would cause any problems? Or if it is even considered good practice?

I set up the archive loop as follows, and was wondering if there is anything that I am missing (such as an already built-in wordpress function)
But basically takes the URL structure for the Archive page that you land on, dissects it, divides it up into year/month/day and then applies a date_query based on it.

Is the following "okay" to use in terms of efficiency and would it be considered an acceptable template?

The Function that "slices" the URL into year/month/day

The Template Part for the Archives

Archive.php Template that pulls everything together

The Result

Functions well no matter what date you select, or whether you just pick a day or a month or a year...but I am curious as to if my code would be considered acceptable or if there is an easier, more modern or simply a wordpress function that takes what I did and condenses it.

What I want to keep: Maximum control over custom elements (this is why I used a query loop...I've always found it the easiest to add whatever elements I want, where I want.)


Viewing all articles
Browse latest Browse all 8245

Trending Articles