I am building a personal website to host my university work, personal projects and photos etc.
The menu is a hierarchical structure made up of pages
and links
. Take my university pages for example. What I would like to achieve is to display posts that are related to the module code which is the page's
slug
.
I've used the following link http://codex.wordpress.org/Page_Templates#A_Page_of_Posts and managed to get it working but I have hard coded the module code into the template, meaning for each module I will have to have a separate template and the only thing that will be different from one file to the next is 5 characters which isn't great for code re-use.
What I am asking, is, is there a way to get the slug
from the page I'm looking at and use that for the WP_Query
arguments.
If you go to http://michaelnorris.co.uk/ and look at the menu structure. Navigate to University -> Year Three -> Individual Project, you will notice the url is http://michaelnorris.co.uk/uni/three/ci301 where ci301
is the module code for the Individual Project
. I want to have this system on each of the module pages so that I can tag posts
and they are displayed in the relevant module.