Create Custom Post Types and Page Templates with a Plugin in WordPress

First, in plugins – > ads add three folders(images, includes, templates) and a file ads.php

ads.php should look like this:

In the images folder add another one called icons. In that folder add this icon or maybe something of your choice.
Name it icon-building.png.

In the includes folder create two files:
This will create post of type oglas with tow taxonomies, ‘lokacii’ and ‘ceni’.


This is a standard class for creating page templates with a plugin. The only code you need to change is this:

You can include as many templates as you want.

The templates folder is where we will add the files with the page templates. I created tow files:
listanje-oglasi.php which will list all posts of type oglas.

and listanje-oglasi-so-taksonimii.php which will list all posts of type oglas with its taxonomies ‘ceni’ and ‘lokacii’

That’s it. let us know if you have any questions.