This question appears to be off-topic because it is about ...
Tutoring with a software named Wordpress, here a Tutorial for Extending it with a specific Plugin and an individual Theme.
Tutoring a Software Product named Magento.
a very individual problem without given any further reference to commons in programming in a useful manner. See also: Stack Overflow question checklist
a Debugging request of larger chunks of non-isolated code that may (or may not) contain the code the question asks about. Instead the code should be reduced the a bare minimum example code that outlines the problem and question in a compact and self-explaining manner.
a Debugging request of larger chunks of non-isolated code that may (or may not) contain the code the problem asks about however there will be much reason and many additional issues an answer would require to touch next to deciphering the problem from this large amount of code.
Please see the following question on meta: http://meta.stackoverflow.com/questions/8231/are-answers-that-just-contain-links-elsewhere-really-good-answers - Also please don't answer such broad questions, leave a comment if you feel like you've got something to share. Also consider to not "feed" users with little infromation bits if the question does not seem to have enough quality for this website. You degrade users a bit like animals that come back attracted by food. Just creating an analogy.
Please don't act like as if a user asking a question here on stackoverflow would be too stupid to use Google. It's somewhat embarassing to treat users like that. Also please don't feed with information bits if you've got the feeling that such is too obvious. Especially not on duplicate questions. So next time better first politely ask if the user could have taken the time to use an internet search engine and direct him/her to one in case he/she denies. Thank you.
Please do not just ask if there is a way to do something or if it is possible to do XYZ. Technically there always is a way if you use software you can change. Instead provide reference that make you think/believe that there is a concrete way to do so, then show what you've done so far (what you've posted in your question is pseudo-code at best it does not show what you've done so far). Only if you do that, it's clear what your concrete problem is and it can be clearly answered.
Lol