Giter VIP home page Giter VIP logo

Comments (5)

westonruter avatar westonruter commented on May 20, 2024

Since this is a theme, would this be as relevant? I should think the theme would have minimal logic. I think it should look a lot like any PHP logic that is found in _s or any of the core themes. Namely: prefixed global functions.

from ampnews.

ThierryA avatar ThierryA commented on May 20, 2024

Correct, there will things like theme support, potentially reusable template tags, potentially customizer settings.

If we decide to go for simple hook -> callback, we can agree to adopt an FP pattern like Underscores does (one of my favorite when done right) rather than an OO Pattern. Underscores doesn't have tests though and anything which contain logic should have tests for it.

Namely: prefixed global functions.

That triggered my attention, we are going to use namespaces right? If yes, then no need to prefix functions.

from ampnews.

westonruter avatar westonruter commented on May 20, 2024

I don't think we should use namespaces for this, necessarily. The goal here is to provide an example theme that will get users up to speed with building an AMP-supporting theme as seamlessly as possible. Using namespaces and OOP and anything else that isn't found in _s could be a barrier to that. So yeah, just prefixed global functions is the normal way to develop a theme that developers are familiar with. We're not trying to create a theme that showcases best practices for modern PHP development. I'm trying to get confirmation, but PHP 5.2 may be required for WordPress.org theme directory as well.

from ampnews.

ThierryA avatar ThierryA commented on May 20, 2024

Roger that.

from ampnews.

ThierryA avatar ThierryA commented on May 20, 2024

Interesting progress on the Servehappy project which is related to this discussion.

from ampnews.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.