Пример #1
0
/**
 * A drop-in replacement for WordPress' get_header()
 * 
 * NOTE: This is largely copied from the WordPress 4.2.2 core
 * 
 * Improvements:
 *   - Function variables do not interfere with included file
 *   - Returns the the return value of the file
 *   - Better Debugging
 *   - Support overrides via template_use_part()
 *   - Also checks content directory
 * 
 * @see https://codex.wordpress.org/Function_Reference/get_header
 * @param string $slug The slug name for the generic template.
 * @param string $name The name of the specialized template.
 * @return mixed       The returned value of the file on success, NULL otherwise
 */
function theme_header($name = NULL)
{
    global $debug, $theme;
    $action = "get_header";
    $debug->runtime_checkpoint('[Theme] Action: ' . $action);
    do_action($action, $name);
    $locations = array();
    $name = (string) $name;
    if (!empty($name)) {
        $locations[] = "header-{$name}";
        $locations[] = $theme->content_sub_path . "/header-{$name}";
    }
    $locations[] = "header";
    $locations[] = $theme->content_sub_path . "/header";
    foreach ($locations as $loc) {
        if (template_part__locate($loc . '.php')) {
            return template_part($loc, $name);
        }
    }
    $debug->runtime_checkpoint('[Theme] Failed Action: ' . $action);
    return NULL;
}
/**
 * A drop-in replacement for WordPress' get_header(), get_footer(), & get_sidebar()
 * 
 * NOTE: This is largely copied from the WordPress 4.2.2 core
 * 
 * Improvements:
 *   - Function variables do not interfere with included file
 *   - Returns the the return value of the file
 *   - Better Debugging
 *   - Supports overrides via template_use_part()
 *   - Also checks content directory
 * 
 * @see https://codex.wordpress.org/Function_Reference/get_footer
 * @param string      $section The name of the section to load
 * @param string|null $name    The name of the specialized template.
 * @return mixed               The returned value of the file on success, NULL otherwise
 */
function theme__section($section, $name = NULL)
{
    global $debug, $theme;
    $action = 'get_' . $section;
    $debug->runtime_checkpoint('[Theme] Action: ' . $action);
    do_action($action, $name);
    $locations = array();
    $name = (string) $name;
    if (!empty($name)) {
        $locations[] = sprintf('%1$s-%2$s', $theme->content_sub_path, $section, $name);
        $locations[] = sprintf('%1$s/%2$s-%3$s', $theme->content_sub_path, $section, $name);
    }
    $locations[] = $section;
    $locations[] = $theme->content_sub_path . '/' . $section;
    foreach ($locations as $loc) {
        if (template_part__locate($loc . '.php')) {
            return template_part($loc, $name);
        }
    }
    $debug->runtime_checkpoint('[Theme] Failed Action: ' . $action);
    return NULL;
}
Пример #3
0
/**
 * The default theme header.
 */
$num_to_eng = array(0 => 'zero', 1 => 'one', 2 => 'two', 3 => 'three', 4 => 'four', 5 => 'five', 6 => 'six', 7 => 'seven', 8 => 'eight', 9 => 'nine', 10 => 'ten', 11 => 'eleven', 12 => 'twelve', 13 => 'thirteen', 14 => 'fourteen', 15 => 'fifteen', 16 => 'sixteen');
$logo_width = $num_to_eng[(int) $theme->get_option('logo_size')];
$menu_width = $num_to_eng[16 - (int) $theme->get_option('logo_size')];
?>
<!DOCTYPE html>
<html <?php 
language_attributes();
?>
>
<head>
<?php 
template_part($theme->content_sub_path . '/head');
?>
</head>
<body <?php 
body_class('public-page');
?>
>
	<div id="page-wrapper">
		<div id="page-container">
			<header class="ui middle aligned stackable page grid" id="main-header-grid">
				<?php 
if ($logo_width != 'zero') {
    ?>
				<div class="<?php 
    echo $logo_width;
    ?>
Пример #4
0
<?php

/**
 * The default page template
 * 
 * Shows pages as the default template without any sidebars.
 */
template_part($theme->template_sub_path . '/default', 'sidebar-none');
<?php

/*
Template Name: Sidebar: None
*/
theme_header();
?>
<main>
	<?php 
template_part($theme->content_sub_path . '/loop', $theme->post_type);
?>
</main>
<?php 
theme_footer();
Пример #6
0
<?php

/**
 * Chooses the template to display
 * 
 * On used when the page doesn't have its "page template" option set.
 */
if (is_404()) {
    // There was an error with the request, display the 404 page.
    template_use_part($theme->template_sub_path . '/default', $theme->template_sub_path . '/default-page');
    template_use_part($theme->content_sub_path . '/loop', $theme->content_sub_path . '/404');
} elseif (is_front_page() || is_home()) {
    // This the home page, which is typically designed differently from the rest of the site
    template_use_part($theme->template_sub_path . '/default', $theme->template_sub_path . '/home');
}
template_part($theme->template_sub_path . '/default', $theme->post_type);
<?php

/*
Template Name: Sidebar: Right
*/
// This just an alias to the default
template_part($theme->template_sub_path . '/default');
Пример #8
0
<?php

/**
 * The footer without any visible content.
 */
?>
				</div>
			</div>
		</div>
	</div>
	
	<!-- Modals -->
	<?php 
template_part($theme->content_sub_path . '/modals');
?>
	<!-- /Modals -->
	
	<?php 
wp_footer();
?>
</body>
</html>
 /**
  * Displays the options page content when called
  * 
  * @return void
  */
 public function options_page()
 {
     template_part($this->theme->template_sub_path . '/theme-options');
 }
Пример #10
0
 * Template Name: Login Page
 */
if (is_user_logged_in()) {
    $loc = home_url();
    if (!empty($_REQUEST['redirect'])) {
        $loc = $_REQUEST['redirect'];
    }
    wp_redirect($loc);
    exit;
}
theme_header('none');
?>
<div class="ui middle aligned center aligned stackable grid" id="login-container">
	<main class="five wide column">
		<?php 
template_part($theme->content_sub_path . '/login-form', $theme->post_type);
?>
	</main>
</div>
<style type="text/css">
	html {
		height: 100% !important;
	}
	html, body, #page-wrapper, #page-container, #main-content-grid {
		height: 100%;
		background: #EFEFEF;
	}
	#login-container {
		height: 100%;
	}
</style>
Пример #11
0
<?php

/**
 * This template loads in the WordPress Dashboard, but produces an error any
 * time it is loaded by someone without the permissions to "Edit Theme Options"
 */
if (current_user_can('edit_theme_options')) {
    ?>
	<div id="theme-options-page" class="ui basic segment" style="max-width:99%;">
		<h1 class="ui huge header">
			Theme Options
			<div class="sub header">
				View the <a target="_blank" href="<?php 
    echo $theme->uri;
    ?>
/asset/docs/">Code Docs</a>
				| Open the <a target="_blank" href="<?php 
    echo $theme->uri;
    ?>
/readme.pdf">README</a>
				| Source on <a target="_blank" href="https://github.com/ProjectCleverWeb/Semantic-UI-WordPress">Github</a></div>
		</h1>
		
		<?php 
    template_part($theme->content_sub_path . '/theme-options/page');
    ?>
	</div>
	<?php 
} else {
    echo 'You do not have permission to edit theme options.';
}
Пример #12
0
$theme->options_update_data();
?>
		
		<!-- Tab Sections -->
		<section class="ui tab active" data-tab="first">
			<?php 
template_part($theme->content_sub_path . '/theme-options/general');
?>
		</section>
		<section class="ui tab" data-tab="second">
			<?php 
template_part($theme->content_sub_path . '/theme-options/meta-tags');
?>
		</section>
		<section class="ui tab" data-tab="third">
			<?php 
template_part($theme->content_sub_path . '/theme-options/about');
?>
		</section>
		<!-- /Tab Sections -->
		
		<br>
		
		<button type="submit" class="ui positive submit button">Save All Options</button>
		<a class="ui button" href="<?php 
echo $theme->options_uri();
?>
">Cancel</a>
	</form>
</div>
Пример #13
0
<main>
	<div class="empty size-10">&nbsp;</div>
	<img src="<?php 
echo esc_url($theme->uri . '/logo.png');
?>
" class="ui centered image">
	<h1 class="ui center aligned dividing header">
		Welcome to Semantic UI for WordPress!
		<?php 
if (current_user_can('edit_theme_options')) {
    ?>
			<div class="sub header">This is the first-run page, you can disable it from the <a href="<?php 
    echo $theme->options_uri();
    ?>
">Theme Options</a> page.</div>
			<?php 
} else {
    ?>
			<div class="sub header">This is the first-run page, <strong>once you login</strong>, you can disable it from the Theme Options page.</div>
			<?php 
}
?>
	</h1>
	<div class="ui basic segment">
		<?php 
template_part($theme->content_sub_path . '/first-run');
?>
	</div>
</main>
<?php 
theme_footer('none');
Пример #14
0
 /**
  * Do WordPress theme integrations
  * 
  * @return void
  */
 public function do_integrations()
 {
     global $debug;
     $debug->runtime_checkpoint('[Theme] Begin WordPress Integrations');
     $integrations = new integrations();
     // Alphebetical based on the callback (doesn't effect the order they are called)
     add_action('admin_bar_menu', array($integrations, 'admin_bar_links'), 999);
     add_action('nav_menu_css_class', array($integrations, 'current_nav'), 10, 1);
     add_action('admin_footer_text', array($integrations, 'dashboard_footer'));
     add_action('init', array($integrations, 'editor_styles'), 11);
     add_action('wp_enqueue_scripts', array($integrations, 'enqueue'));
     add_action('user_contactmethods', array($integrations, 'google_author'));
     add_action('after_setup_theme', array($integrations, 'init'));
     add_action('admin_menu', array($integrations, 'options'));
     add_action('login_enqueue_scripts', array($integrations, 'options'));
     add_action('post_thumbnail_html', array($integrations, 'post_thumbnail'), 10, 3);
     add_action('init', array($integrations, 'register_enqueue'), 10);
     add_action('get_search_form', array($integrations, 'search_form'));
     add_action('widgets_init', array($integrations, 'widgets_init'));
     add_action('wp_title', array($integrations, 'wp_title'), 10, 2);
     add_action('template_include', array($integrations, 'set_post_type'));
     if ($debug->active) {
         $debug->runtime_checkpoint('[Theme] Adding Debug WordPress Integrations');
         template_part($this->include_sub_path . '/debug_hooks');
     }
     $debug->runtime_checkpoint('[Theme] Finished WordPress Integrations');
 }