source/php/Module.php
public function getOnePageModules() : array
    {
        $modules = array();

        if (is_front_page() && is_plugin_active('modularity-onepage/modularity-onepage.php')) {
            $postStatus = array('publish');
            if (is_user_logged_in()) {
                $postStatus[] = 'private';
            }

            $sections = get_posts(array(
                'post_type' => 'onepage',
                'post_status' => $postStatus,
                'orderby' => 'menu_order',
                'order' => 'asc',
                'posts_per_page'   => -1
            ));

            foreach ($sections as $section) {
                $section_modules = \Modularity\Editor::getPostModules($section->ID);

                if (!isset($section_modules['onepage-sidebar'])) {
                    continue;
                }

                $section_modules = $section_modules['onepage-sidebar']['modules'];
                if (is_array($section_modules) && !empty($section_modules)) {
                    foreach ($section_modules as $module) {
                        if (!$module->hidden) {
                            $modules[] = $module;
                        }
                    }
                }
            }
        }

        return $modules;
    }
public function getOnePageModules() : array
    {
        $modules = array();

        if (is_front_page() && is_plugin_active('modularity-onepage/modularity-onepage.php')) {
            $postStatus = array('publish');
            if (is_user_logged_in()) {
                $postStatus[] = 'private';
            }

            $sections = get_posts(array(
                'post_type' => 'onepage',
                'post_status' => $postStatus,
                'orderby' => 'menu_order',
                'order' => 'asc',
                'posts_per_page'   => -1
            ));

            foreach ($sections as $section) {
                $section_modules = \Modularity\Editor::getPostModules($section->ID);

                if (!isset($section_modules['onepage-sidebar'])) {
                    continue;
                }

                $section_modules = $section_modules['onepage-sidebar']['modules'];
                if (is_array($section_modules) && !empty($section_modules)) {
                    foreach ($section_modules as $module) {
                        if (!$module->hidden) {
                            $modules[] = $module;
                        }
                    }
                }
            }
        }

        return $modules;
    }
public function getOnePageModules ( ) : array { $ modules = array ( ) ; if ( is_front_page ( ) && is_plugin_active ( 'modularity-onepage/modularity-onepage.php' ) ) { $ postStatus = array ( 'publish' ) ; if ( is_user_logged_in ( ) ) { $ postStatus [ ] = 'private' ; } $ sections = get_posts ( array ( 'post_type' => 'onepage' , 'post_status' => $ postStatus , 'orderby' => 'menu_order' , 'order' => 'asc' , 'posts_per_page' => - 1 ) ) ; foreach ( $ sections as $ section ) { $ section_modules = \ Modularity \ Editor :: getPostModules ( $ section -> ID ) ; if ( ! isset ( $ section_modules [ 'onepage-sidebar' ] ) ) { continue ; } $ section_modules = $ section_modules [ 'onepage-sidebar' ] [ 'modules' ] ; if ( is_array ( $ section_modules ) && ! empty ( $ section_modules ) ) { foreach ( $ section_modules as $ module ) { if ( ! $ module -> hidden ) { $ modules [ ] = $ module ; } } } } } return $ modules ; }
Get modules used in one page sections
@return array Array with modules from one page sections
Get modules used in one page sections