/**
 * Set up AudioTheme templates when they're loaded.
 *
 * Limits default scripts and styles to load only for AudioTheme templates.
 *
 * @since 1.2.0
 */
function audiotheme_template_setup($template)
{
    if (is_audiotheme_default_template($template)) {
        add_action('wp_enqueue_scripts', 'audiotheme_enqueue_scripts');
    }
}
Exemple #2
0
/**
 * Set posts per page for video archives if the default templates are being
 * loaded.
 *
 * The default video archive template uses a 4-column grid. If it's loaded from
 * the plugin, set the posts per page arg to a multiple of 4.
 *
 * @since 1.3.0
 *
 * @param object $query The main WP_Query object. Passed by reference.
 */
function audiotheme_video_default_template_query($query)
{
    global $wpdb;
    if (is_admin() || !$query->is_main_query() || !is_post_type_archive('audiotheme_video') || !is_tax('audiotheme_video_category')) {
        return;
    }
    // The default video archive template uses a 4-column grid.
    // If it's being loaded from the plugin, set the posts per page arg to a multiple of 4.
    if (is_audiotheme_default_template(audiotheme_locate_template('archive-video.php'))) {
        if ('' === $query->get('posts_per_archive_page')) {
            $query->set('posts_per_archive_page', 12);
        }
    }
}
/**
 * Set posts per page for record archives if the default templates are being
 * loaded.
 *
 * The default record archive template uses a 4-column grid. If it's loaded from
 * the plugin, set the posts per page arg to a multiple of 4.
 *
 * @since 1.3.0
 *
 * @param object $query The main WP_Query object. Passed by reference.
 */
function audiotheme_record_default_template_query($query)
{
    if (is_admin() || !$query->is_main_query() || !is_post_type_archive('audiotheme_record')) {
        return;
    }
    if (is_audiotheme_default_template(audiotheme_locate_template('archive-record.php'))) {
        if ('' === $query->get('posts_per_archive_page')) {
            $query->set('posts_per_archive_page', 12);
        }
    }
}