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
.