Use Repository Pattern in WP theme
Question
In my template files I have a lot of WP_Query to get posts of an author or from a specif category ecc… I’m thinking to use Repository Patter in order to have cleaner code and a layer between database and theme.
This PostRepository class will have some methods like:
– getByID
– getByAuthor
– getByCategory
Could be a good idea? Have somebody use somethink like this?
0
oop, repository, wp-query
4 years
2019-03-21T01:54:51-05:00
2019-03-21T01:54:51-05:00 0 Answers
80 views
0
Leave an answer