WordPress.org

Ready to get started?Download WordPress

Forums

Any Possible problems with the following? Archive Template (Code Review) (6 posts)

  1. Endlyss
    Member
    Posted 8 months ago #

    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.)

  2. @Endlyss? Please do not create duplicate accounts to post the same thing. I'm sure you had good intentions but really, please don't.

    Use this account. When you create and use accounts that way distant alarm bells ring. ;)

  3. Endlyss
    Member
    Posted 8 months ago #

    @Jan

    The previous posts were locked. I apologize. I had tried twice over the span of 3 hours and neither of the posts published or were showing up on the topics list...wasn't letting me edit or reply or anything, and when I came to it from another computer it redirected me to the support homepage.

    For future reference, a few questions, please:
    1)is there a waiting period for questions to appear? because this definitely wasn't working before. and no new posts were publishing.

    2) is there a way to contact any mods on here to do things like check statuses on posts? one of the things I tried was to find a way to contact any kind of admins and if you guys have one, it is really well hidden >_>. If I had been able to send in some kinda ticket, that would have probably kept me from making the secondary account, hahaha.

    Also thank you for clearing it up, since it is working now.

  4. The previous posts were locked. I apologize.

    Thank you for that but no apology is needed. It's all good. ;)

    I had tried twice over the span of 3 hours and neither of the posts published or were showing up on the topics list...wasn't letting me edit or reply or anything, and when I came to it from another computer it redirected me to the support homepage.

    Your posts are hitting the spam queue. When that happens please try to be patient and a moderator will release your posts.

    Regarding questions 1 and 2, it really is just a matter of waiting. Just like yourself the moderators are volunteers. Reviewing the spam queue is part of that responsibility.

  5. Endlyss
    Member
    Posted 8 months ago #

    Well that's odd, that they did O_o...

    Glad it is all cleared up now. Definitely didn't mean to upset the spam filter, haha. Hope you have a great night and thanks again.

  6. Endlyss
    Member
    Posted 8 months ago #

    ...Apparently a vast amount of my code was useless.

    Figured out that my custom queries were useless. A horrible assumption on my part to believe that they were necessary as that was hours of time wasted...haha.

    I guess that next time I'll look into have_posts() more before I use automatically turn to querying.

    Lesson learned.

Reply

You must log in to post.

About this Topic

Tags

No tags yet.