/** * Enqueue scripts. */ public function admin_enqueue_scripts() { // Bail if we're not on the edit post screen. if (get_current_screen()->base != 'toplevel_page_media-guide') { return; } wp_enqueue_media(); wp_enqueue_script('highlight-js', plugin_dir_url(__FILE__) . 'includes/highlight/highlight.pack.js'); wp_enqueue_style('highlight-js', plugin_dir_url(__FILE__) . 'includes/highlight/styles/monokai_sublime.css'); wp_enqueue_style('wp-media-backbone-tutorial', plugin_dir_url(__FILE__) . 'style.css'); // Load the documentation javascript for a section page. if (self::is_section_page()) { wp_enqueue_script('wp-media-backbone-tutorial', plugin_dir_url(__FILE__) . 'script.js', array('media-views', 'media-models', 'highlight-js')); } // Load the example javascript and stylesheet for an example page. if (self::is_example_page()) { $example_id = self::get_current_example(); $example_script_src = sprintf(plugin_dir_url(__FILE__) . 'sections/%s/examples/%s/script.js', WPMJG::get_current_section(), WPMJG::get_current_example()); wp_enqueue_script('wp-media-backbone-tutorial-example-' . $example_id, $example_script_src, array('media-views', 'media-models')); $example_style_src = sprintf(plugin_dir_url(__FILE__) . 'sections/%s/examples/%s/style.css', WPMJG::get_current_section(), WPMJG::get_current_example()); wp_enqueue_style('wp-media-backbone-tutorial-example-' . $example_id, $example_style_src); } }
require 'menu.php'; ?> <?php require '../sections/' . WPMJG::get_current_section() . '/index.php'; ?> <div class="entry-template"> <h3>Title</h3> <p>Content</p> <div class="example"> <h3>Example: title</h3> <h4>Live Example <a class="add-new-h2" target="_blank" href="<?php echo WPMJG::get_example_url(WPMJG::get_current_section(), 1); ?> ">open in a new window</a></h4> <iframe class="iframe-interactive-demo" src="<?php echo WPMJG::get_example_url(WPMJG::get_current_section(), 1); ?> "></iframe> <h4>Markup</h4> <pre><code class="language-html"><?php WPMJG()->the_section_example_markup(WPMJG::get_current_section(), 1); ?> </code></pre> <h4>Javascript</h4> <pre><code class="language-javascript"><?php WPMJG()->the_section_example_javascript(WPMJG::get_current_section(), 1); ?> </code></pre> </div> </div> </div>
<div class="wrap"> <h2>WordPress Media Backbone Guide</h2> <?php require plugin_dir_path(__FILE__) . 'menu.php'; $section_index_path = WPMJG::get_instance()->directory->sections . WPMJG::get_current_section() . '/index.php'; if (file_exists($section_index_path)) { require $section_index_path; } else { require WPMJG::get_instance()->directory->plugin_root . '/templates/404.php'; } ?> </div>