Posts tagged addhooks
AddHooks
Jun 26th
AddHooks is one of my volatile idea when creating a wordpress theme.
Just like its name, it add the content from functions.php files to the hook assigned to it.
This will make the template files look clean and neat, but will make the functions.php rather messy.
The concept is to store the desired html or php code in a functions.
For example, this is my header.php codes when using AddHooks concept.
<?php
/**
* @package Add Hooks
* @since version 0.1
* @WordPress 2.7.1
* @Pangeran Wiguan
* @WPThemestudio.com
*/
addhooks_header_opening(); ?>
<?php google_custom_search_stylesheet(); ?>
<?php wp_head(); ?>
<?php addhooks_header_closing(); ?>
<<body>
The <?php addhooks_header_opening(); ?> calls a function which stored in a functions.php where the function will look like below.
<?php
/**
* @package Add Hooks
* @since version 0.1
* @WordPress 2.7.1
* @Pangeran Wiguan
* @WPThemestudio.com
*/
function addhooks_header_opening() { ?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd“>
<!– //
The rest of the code… too long to put it here
// –>
<?php } ?>
Well, it’s just a concept…
A concept theme that have come into reality, you can see it on my personal blog, live and running.
Click the image to navigate to see the live preview.
This is a real running blog actually.
