Connect with us

Published on: 12 Sep 2016

In this new series of short articles called #whyusemodx I will showcase why we at Any Screen Size choose MODX for almost all of our web projects.

In this first part I will show the simple and clean code MODX uses, this makes using templates and the CMS very simple and easy, no need to know PHP or Javascript!

Getting a list of posts using Wordpress

Below I will show the code that is used in the official Wordpress theme twentysixteen, this is the most popular and widely used theme from the official Wordpress website.

WordPress default loop

Wordpress forces you to use PHP and something they call a loop to get a list of articles:


So this looks pretty advanced to someone who does not know a lot of PHP!

Getting a list of resources (could be posts, products, FAQ's or anything else) using MODX

So how would we get a list of posts using MODX?

MODX pdoResources call

The plugin to use for this is pdoTools, and once you install it you simpy add the following pdoResources call (included in pdoTools) to your template code:


I love this simple code! This simply tells MODX to display a list of resources.


The only option we really need is &tpl this is used to assign the HTML code to be used to list each post item. A very basic example would be to create a chunk called articleItemTpl:


Lets compare Wordpress VS MODX template code

I don't know about you, but I prefer clean and neat code that is structured and sperated by type: HTML should be only HTML, PHP only PHP. With Wordpress you end up with many HTML files that contain huge blocks of PHP code, it is one of the most confusing parts of using Wordpress and using the loop can be a huge pain.

So how do you want your template code to look?

Wordpress template code


MODX template code


Get MODX for free at, need help with a MODX project? Contact us!

Read this article on Medium and like it!

Feel free to contact us to find out if we can help you improve your website.

Lets chat free of charge