seb86/Auto-Load-Next-Post

View on GitHub
includes/theme-support/class-alnp-make.php

Summary

Maintainability
A
2 hrs
Test Coverage
<?php
/**
 * Auto Load Next Post Theme Support: Make
 *
 * Applies support for The Theme Foundry Make Theme.
 *
 * @since    1.5.0
 * @author   Sébastien Dumont
 * @category Theme Support
 * @package  Auto Load Next Post/Theme Support
 * @license  GPL-2.0+
 */

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

/**
 * ALNP_Make class.
 */
class ALNP_Make {

    /**
     * Initlize Theme.
     *
     * @access public
     * @static
     */
    public static function init() {
        // Filters the repeater template location.
        add_filter( 'alnp_template_redirect', array( __CLASS__, 'alnp_make_template_redirect' ) );

        // Add theme support and preset the theme selectors.
        add_action( 'after_setup_theme', array( __CLASS__, 'add_theme_support' ) );
    } // END init()

    /**
     * Filters the location of the repeater template.
     *
     * @access public
     * @static
     * @return string
     */
    public static function alnp_make_template_redirect() {
        return AUTO_LOAD_NEXT_POST_FILE_PATH . '/template/theme-support/make/content-alnp.php';
    } // END alnp_make_template_redirect()

    /**
     * Add theme support by providing the theme selectors
     * to be applied once the theme is activated.
     *
     * @access public
     * @static
     */
    public static function add_theme_support() {
        add_theme_support( 'auto-load-next-post', array(
            'content_container'    => 'main.site-main',
            'title_selector'       => 'h1.entry-title',
            'navigation_container' => 'nav.post-navigation',
            'comments_container'   => 'div#comments',
            'load_js_in_footer'    => 'no',
            'lock_js_in_footer'    => 'no',
        ) );
    } // END add_theme_support()

} // END class

ALNP_Make::init();