Type Name: Action

appthemes_after_page_title

Runs in the loop.php and loads after the page title.

Usage

This hook provides no parameters. You use this hook by having your function echo output to the browser, or by having it perform background tasks. Your functions shouldn’t return, and shouldn’t take any parameters.

add_action( 'appthemes_after_page_title', 'your_function' );

Example: Print Date

You can use this space to print meta data, like the date

<?php
function insert_date() { 
    echo '<p>' . get_the_date() . '</p>';
}
add_action( 'appthemes_after_page_title', 'insert_date' ); 
?>

Changelog

  • since 1.1

Source File

appthemes_after_page_title() is located in page.php.

appthemes_before_page_title

Runs in the page.php file and loads before the page title.

Usage

This hook provides no parameters. You use this hook by having your function echo output to the browser, or by having it perform background tasks. Your functions shouldn’t return, and shouldn’t take any parameters.

add_action( 'appthemes_before_page_title', 'your_function' );

Example: Advertisment

This code would display an AppThemes banner advertisement above the content of every page.

<?php
function insert_banner_ad_before_page() { 
    echo '<a href="http://www.appthemes.com"><img src="http://www.appthemes.com/ads/at-468x60a.gif"></a>';
}
add_action( 'appthemes_before_page_title', 'insert_banner_ad_before_page' ); 
?>

Example: Adding an Announcement Bar

You can insert special information for the user about a sale, upcoming event, or other notification here.

<?php
function sale_annoucement() { 
    echo '<div class="annoucement">' . __( 'Come back July 5th for 10% off everything!', 'appthemes' ) . '</div>';
}
add_action( 'appthemes_before_page_title', 'sale_annoucement' ); 
?>

Changelog

  • since 1.1

Source File

appthemes_before_page_title() is located in page.php and any other page templates.

appthemes_before_page

Executes in the page.php file and runs after have_posts() within the loop whenever any page is loaded.

Usage

This hook provides no parameters. You use this hook by having your function echo output to the browser, or by having it perform background tasks. Your functions shouldn’t return, and shouldn’t take any parameters.

add_action( 'appthemes_before_page', 'your_function' );

Example: Advertisment

This code would display an AppThemes banner advertisement above the content of every page.

<?php
function insert_banner_ad_before_page() { 
    echo '<a href="http://www.appthemes.com"><img src="http://www.appthemes.com/ads/at-468x60a.gif"></a>';
}
add_action( 'appthemes_before_page', 'insert_banner_ad_before_page' ); 
?>

Example: Adding an Announcement Bar

You can insert special information for the user about a sale, upcoming event, or other notification here.

<?php
function sale_annoucement() { 
    echo '<div class="annoucement">' . __( 'Come back July 5th for 10% off everything!', 'appthemes' ) . '</div>';
}
add_action( 'appthemes_before_page', 'sale_annoucement' ); 
?>

Changelog

  • since 1.1

Source File

appthemes_before_page() is located in page.php.

appthemes_before_page_loop

Runs in the page.php file and runs before the have_posts() loop whenever any page is loaded.

Usage

This hook provides no parameters. You use this hook by having your function echo output to the browser, or by having it perform background tasks. Your functions shouldn’t return, and shouldn’t take any parameters.

add_action( 'appthemes_before_page_loop', 'your_function' );

Example: Advertisment

This code would display an AppThemes banner advertisement above the content of every page.

<?php
function insert_banner_ad_before_page_loop() { 
    echo '<a href="http://www.appthemes.com"><img src="http://www.appthemes.com/ads/at-468x60a.gif"></a>';
}
add_action( 'appthemes_before_page_loop', 'insert_banner_ad_before_page_loop' ); 
?>

Example: Adding an Announcement Bar

You can insert special information for the user about a sale, upcoming event, or other notification here.

<?php
function sale_annoucement() { 
    echo '<div class="annoucement">' . __( 'Come back July 5th for 10% off everything!', 'appthemes') . '</div>';
}
add_action( 'appthemes_before_page_loop', 'sale_annoucement' ); 
?>

Changelog

  • since 1.1

Source File

appthemes_before_page_loop() is located in page.php.

appthemes_after_header

Runs in the header.php file and loads after the theme header code.

Usage

This hook provides no parameters. You use this hook by having your function echo output to the browser, or by having it perform background tasks. Your functions shouldn’t return, and shouldn’t take any parameters.

add_action( 'appthemes_after_header', 'your_function' );

Example: Advertisment

This code would display an AppThemes banner advertisement above the content of every page.

<?php
function insert_banner_ad_before_page() { 
    echo '<a href="http://www.appthemes.com"><img src="http://www.appthemes.com/ads/at-468x60a.gif"></a>';
}
add_action( 'appthemes_after_header', 'insert_banner_ad_before_page' ); 
?>

Example: Adding an Announcement Bar

You can insert special information for the user about a sale, upcoming event, or other notification here.

<?php
function sale_annoucement() { 
    echo '<div class="annoucement">' . __('Come back July 5th for 10% off everything!', 'appthemes') . '</div>';
}
add_action( 'appthemes_after_header', 'sale_annoucement' ); 
?>

Changelog

  • since 1.1

Source File

appthemes_after_header() is located in includes/header.php.

appthemes_header

Runs in the header.php and loads in the theme header code found in /includes/theme-header.php. This function can also be removed using remove_action() if you prefer to use your own theme header code instead.

Usage

This hook provides no parameters. You use this hook by having your function echo output to the browser, or by having it perform background tasks. Your functions shouldn’t return, and shouldn’t take any parameters.

add_action( 'appthemes_header', 'your_function' );

Example: Replacing Theme Header

To replace the default header, simply call remove_action() on the theme’s default header function, and then add your own.

function unhook_appthemes_functions() {
  // unload the default ClassiPress theme header
  remove_action( 'appthemes_header', 'cp_header' );
}
add_action('init','unhook_appthemes_functions');
 
 
// let's add our own header instead
function my_theme_header() { 
    // do something here
}
add_action( 'appthemes_header', 'my_theme_header' );

Example: Adding an Announcement Bar

If you don’t remove the default header (or give your function a higher priority), your code will run after the default header code. While you should use the appthemes_after_header() action hook, you can get similar functionality here.

function sale_annoucement() { 
    echo '<div class="annoucement">' . __( 'Come back July 5th for 10% off everything!', 'appthemes') . '</div>';
}
add_action( 'appthemes_after_header', 'sale_annoucement' );

Changelog

  • since 1.1

Source File

appthemes_header() is located in includes/header.php.

appthemes_before_header

Runs in the header.php after the opening div tag and before the main header section is called at the top of the theme.

Usage

This hook provides no parameters. You use this hook by having your function echo output to the browser, or by having it perform background tasks. Your functions shouldn’t return, and shouldn’t take any parameters.

add_action( 'appthemes_before_header', 'your_function' );

Example: Advertisment

This code would display an AppThemes banner advertisement above the content of every page.

<?php
function insert_banner_ad_before_page() { 
    echo '<a href="http://www.appthemes.com"><img src="http://www.appthemes.com/ads/at-468x60a.gif"></a>';
}
add_action( 'appthemes_before_header', 'insert_banner_ad_before_page' ); 
?>

Example: Adding an Announcement Bar

You can insert special information for the user about a sale, upcoming event, or other notification here.

<?php
function sale_annoucement() { 
    echo '<div class="annoucement">' . __('Come back July 5th for 10% off everything!', 'appthemes') . '</div>';
}
add_action( 'appthemes_before_header', 'sale_annoucement' ); 
?>

Changelog

  • since 1.1

Source File

appthemes_before_header() is located in includes/header.php.

appthemes_after

Description

Runs in the footer.php before the closing html body tag and after all divs.

<?php
function appthemes_after() { 
    do_action('appthemes_after'); 
}
?>

Example

<?php
function insert_code_after_stuff() { 
    // do something here
}
add_action( 'appthemes_after', 'insert_code_after_stuff' ); 
?>

Changelog

  • since 1.1

Source File

appthemes_after() is located in includes/appthemes-hooks.php.

appthemes_before

Description

Runs in the header after the opening html body tag and before any divs.

<?php
function appthemes_before() { 
    do_action('appthemes_before'); 
}
?>

Example

<?php
function insert_code_before_stuff() { 
    // do something here
}
add_action( 'appthemes_before', 'insert_code_before_stuff' ); 
?>

Changelog

  • since 1.1

Source File

appthemes_before() is located in includes/appthemes-hooks.php.

appthemes_meta

Description

Runs in the html head where the meta tags are located. This is an ideal spot to load any additional meta tags. For loading .css and .js files, you should use wp_head() instead.

<?php
function appthemes_meta() { 
    do_action('appthemes_meta'); 
}
?>

Example

If you’d like to insert a Google Analytics meta tag without modifying the header.php theme file, this is the perfect hook to use. Here’s how to do it. Drop the following code in your functions.php file.

<?php
function insert_google_analytics_meta() { 
    echo '<meta name="google-site-verification" content="dBw5CvburAxi537Rp9qi">';
}
add_action( 'appthemes_meta', 'insert_google_analytics_meta' ); 
?>

You’d replace the content=”” with the unique one Google Analytics provides you, however.

Changelog

  • since 1.1

Source File

appthemes_meta() is located in includes/appthemes-hooks.php.