/** * Register the stylesheets for the public-facing side of the site. * * @since 0.1 */ public function enqueue_styles() { /** * This function is provided for demonstration purposes only. * * An instance of this class should be passed to the run() function * defined in Pressbooks_Metadata_Loader as all of the hooks are defined * in that particular class. * * The Pressbooks_Metadata_Loader will then create the relationship * between the defined hooks and the functions defined in this * class. */ $pm_BM = Pressbooks_Metadata_Book_Metadata::get_instance(); $meta = $pm_BM->get_current_metadata_flat(); foreach ($meta as $elt) { if ($elt->get_name() === 'Level') { $level = $elt; } } $level = $level ? strtolower($level) : ''; if (empty($level)) { wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__) . 'css/pressbooks-lingua-theme-public.css', array(), $this->version, 'all'); } else { wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__) . 'css/pressbooks-lingua-theme-public-' . $level . '.css', array(), $this->version, 'all'); } }
/** * Prints the book meta tags containing microdata information. */ function print_book_microdata_itemprops_list() { $pm_BM = Pressbooks_Metadata_Book_Metadata::get_instance(); $pm_BM->print_microdata_itemprops_list(); }
<?php if (get_option('blog_public') == '1' || get_option('blog_public') == '0' && current_user_can_for_blog($blog_id, 'read')) { ?> <div id="sidebar"> <ul id="booknav"> <!-- filepath to --> <?php $pathparts = explode('/', site_url()); $length = count($pathparts); unset($pathparts[$length - 1]); array_values($pathparts); $filepath = implode('/', $pathparts); $pm_BM = Pressbooks_Metadata_Book_Metadata::get_instance(); $meta = $pm_BM->get_current_metadata_flat(); foreach ($meta as $key => $elt) { if ($elt->get_name() === 'Target language') { $target = $elt->get_value(); } } $target = $target ? strtolower($target) : ''; ?> <li id="flag_li" class="home-btn"><a class="<?php echo $target; ?> " href="<?php echo $filepath; ?> "><?php