The Archive's Action Hooks

Whenever the Archive is rebuilt, there are four Action Hooks that are triggered:

Adding Content to the Archive

The code below places a paragraph on top of a list of books. A 'Book' Post Type can be added to a WordPress website via the Custom Post Type functionality.

function insert_paragraph_before_book_list( $archiveBuilder ) {
	if ( $archiveBuilder->listID() == 'book' )
		$archiveBuilder->addContent('

A paragraph on the listed books.

'); } add_action( 'sitetree_will_build_list', 'insert_paragraph_before_book_list' );

The $archiveBuilder parameter is a reference to the object of class SiteTreeArchiveBuilder to which is assigned the task of building the Archive. Its class' interface, declared in core/builders-interfaces.php, is the following:

interface SiteTreeArchiveBuilderInterface {
    /**
     * Returns the unique identifier of the list that is being built.
     * For Custom Post Types, it coincides with the Post Type Key.
     *
     * @since 2.0
     * @return string      
     */
    public function listID();
    
    /**
     * @since 2.0
     * @param string $string      
     */
    public function addContent( $string );
}