extension joomla, template joomla,banner extension joomla,jomla slider,slider joomla

In this post we’ll review how to write a PHP function and go over the basic idea of how you can use Action Hooks in your WordPress Theme. We’ll take a look at a practical example of injecting a Welcome Blurb into your Theme without touching the existing code and we’ll also look at how to remove existing content being injected into Theme Hooks.

Packing Up A Function

Action hooks are in a lot of WordPress Themes nowadays. There’s a good reason for that but you’re probably wondering what the big deal is right? They’re such a big deal because firstly, they’re incredibly easy to use and secondly, because they’re extremely powerful.

If you want to get started with them we’re going to have to take a look at how to write a PHP function again. Don’t worry, we’ll keep it pretty simple.

 

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
function pretty_basic() {
 
   // This is a PHP comment.
 
   // PHP "stuff" goes here.
 
}
 
function still_pretty_basic() { ?>
 
   <!-- HTML comment now -->
 
   <!-- Notice how I "broke out" of writing PHP? -->
 
   <!-- I added closing and opening PHP tags just inside the curly braces -->
 
   <?php // I can even write more familiar-looking PHP here ?>
 
<?php }

So that’s how you write a PHP function. It’s pretty easy. It’s a little package of “stuff” like more PHP or HTML that you can write in 1 place—like your functions.php file—and call in another place like so:

1
2
3
<?php pretty_basic() ?>
 
<?php still_pretty_basic() ?>

You’ve seen the same thing before with WordPress functions likewp_list_pages() or the_content(). These functions are packed with “stuff” deep in the bowels of the WordPress core and output wherever they appear in your template files.