Jetpack::is_module_active PHP Method

is_module_active() public static method

Check whether or not a Jetpack module is active.
public static is_module_active ( string $module ) : boolean
$module string The slug of a Jetpack module.
return boolean
    public static function is_module_active($module)
    {
        return in_array($module, self::get_active_modules());
    }

Usage Example

コード例 #1
1
ファイル: template-tags.php プロジェクト: peisheng/wp
    /**
     * Display navigation to next/previous set of posts when applicable.
     */
    function create_paging_nav()
    {
        // Don't print empty markup if there's only one page.
        if ($GLOBALS['wp_query']->max_num_pages < 2) {
            return;
        }
        $pagination_type = get_theme_mod('pagination_type', create_get_default_theme_options('pagination_type'));
        /**
         * Check if navigation type is Jetpack Infinite Scroll and if it is enabled, else goto default pagination
         * if it's active then disable pagination
         */
        if (('infinite-scroll-click' == $pagination_type || 'infinite-scroll-scroll' == $pagination_type) && class_exists('Jetpack') && Jetpack::is_module_active('infinite-scroll')) {
            return false;
        } elseif ('numeric' == $pagination_type && function_exists('the_posts_pagination')) {
            // Previous/next page navigation.
            the_posts_pagination(array('prev_text' => __('Previous page', 'create'), 'next_text' => __('Next page', 'create'), 'before_page_number' => '<span class="meta-nav screen-reader-text">' . __('Page', 'create') . ' </span>'));
        } else {
            ?>
		<nav class="navigation paging-navigation" role="navigation">
			<h1 class="screen-reader-text"><?php 
            _e('Posts navigation', 'create');
            ?>
</h1>
			<div class="nav-links">

				<?php 
            if (get_next_posts_link()) {
                ?>
				<div class="nav-previous"><?php 
                next_posts_link(__('<span class="meta-nav">&larr;</span> Older posts', 'create'));
                ?>
</div>
				<?php 
            }
            ?>

				<?php 
            if (get_previous_posts_link()) {
                ?>
				<div class="nav-next"><?php 
                previous_posts_link(__('Newer posts <span class="meta-nav">&rarr;</span>', 'create'));
                ?>
</div>
				<?php 
            }
            ?>

			</div><!-- .nav-links -->
		</nav><!-- .navigation -->
	<?php 
        }
    }
All Usage Examples Of Jetpack::is_module_active
Jetpack