/ Published in: PHP
Instead of requiring the loop.php file in your custom themes you can use there two functions, placed in your functions.php file to not only automatically include it, but make a dead simple to filter sections out on a page by page basis negating the need for special loops for specific page types (like a search loop or a main index loop)
The first section is the code you put into your functions file.
The second is how you would call the new "the_loop()" function, simple but all the individual sections you want filtered out as variables, one after another.
The third sections is how you would go about filtering items out.
More information at the link, questions or comments can be posted here or there and I'll get back to you whenever I can.
The first section is the code you put into your functions file.
The second is how you would call the new "the_loop()" function, simple but all the individual sections you want filtered out as variables, one after another.
The third sections is how you would go about filtering items out.
More information at the link, questions or comments can be posted here or there and I'll get back to you whenever I can.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// in the functions.php file function the_loop(){ require 'loop.php'; } function display($v){ global $h; return $h[$v]; }else{ return true; } } // how you call the new loop on your theme page the_loop('comments','meta'); // how you'd go about filtering items out of the loop, in this case comments and meta would be filtered if(display('title')){ // Your title display code } if(display('meta')){ // Your meta display code } if(display('content')){ // Your content display code } if(display('comments')){ // Your comments display code }
URL: http://fatfolderdesign.com/308/unimportant/simpler-single-loop-wordpress-theme-creation