Categories
PHP Wordpress

Adding actions to wordpress based on events

add_action($tag, $function_to_add, $priority, $accepted_args);
add_filter($tag, $function_to_add, $priority, $accepted_args);

The $tag parameter is where you specify the hook you want to add to; $function_to_add is the name of your function. The next two are optional, but worth knowing about: $priority is used to determine the order in which your action ought to occur, relative to other actions that might be happening on the same hook—larger numbers happen later. $accepted_args

And to remove them (notice you have to do this indirectly):

function remove_some_filter() {
  remove_filter(tag, function, priority, args);
}

add_action('init', 'remove_some_filter')


Example:

add_action('wp_head', 'wicked_favicon')

This runs everytime the page head is constructed, you can have the specific function inside functions.php:

function wicked_favicon() {
  echo '<link rel="shortcut icon" href="' 
      . get_bloginfo('stylesheet_directory') 
      . '/images/favicon.ico"/>';
}

Categories
Wordpress

WordPress: choosing and modifying a theme

1) Download thematic (as the parent theme)
2) Create a child theme folder for the new site, and activate it using wordpress admin screen
3) Choose the basic layout you need, by modifying this line:
@import url(‘../thematic/library/layouts/2c-r-fixed.css’);
You can also create your own layout at this point if you feel like it. Same with typography or other things.
4) You can also modify the default main css to your site by creating a local copy on your child theme:
@import url(‘newstyles.css’);
5) Modify the templates and functions from the parent directory directly at the child’s folder, that way
you can always update the parent theme without affecting the child

Correction: 20/11 newest wordpress theme is set to be HTML5 already. Use that instead.