Use get_template_part() into a plugin
I am looking to find a solution to use the
get_template_part()function inside my plugin, do you know any ways that will let me accomplish that?
I am developing a plugin that should show a tab system and on each tab I should show different kinds of WordPress Loops (you now… Most Recent, Most Viewed, Most Commented and so on…). I aim to keep my code as clean as possible and I thought to use some include function but, and here comes the first problem, each time that I try to include a file with a custom loop the code does not run properly, well doesn’t run at all leaving me with a blank area. I have tried to put the code for the Loop inside the main file and everything works correctly but each time I try to include a Loop nothing happen.
So, I tried to run
get_template_part()and this works pretty well but I have to relate with the theme files and this is completely wrong from a plugin point of view…
I start to think that there are no other ways to include a Loop if not to code it straight into the main file, am I right? There are no other way that I could leverage the power of
For the records, I have tested my include and require paths and also the structure of my personalized Loop and they works just fine.
Thanks in advance for the help!
- The topic ‘Use get_template_part() into a plugin’ is closed to new replies.