示例#1
0
/**
 * Generates the relevant template info.  Adds template meta with theme version.  Uses the theme 
 * name and version from style.css.  In 0.6, added the hybrid_meta_template 
 * filter hook.
 *
 * @since 0.4.0
 * @access private
 * @return void
 */
function hybrid_meta_template()
{
    $data = hybrid_get_theme_data();
    $template = '<meta name="template" content="' . esc_attr("{$data['Title']} {$data['Version']}") . '" />' . "\n";
    echo apply_atomic('meta_template', $template);
}
示例#2
0
/**
 * Shortcode to display a link to the child theme's page.
 *
 * @since 0.6.0
 * @uses get_theme_data() Gets theme (child theme) information.
 */
function hybrid_child_link_shortcode()
{
    $data = hybrid_get_theme_data('stylesheet');
    return '<a class="child-link" href="' . esc_url($data['URI']) . '" title="' . esc_attr($data['Name']) . '"><span>' . esc_html($data['Name']) . '</span></a>';
}
示例#3
0
/**
 * Adds a help tab to the theme settings screen if the theme has provided a 'Documentation URI' and/or 
 * 'Support URI'.  Theme developers can add custom help tabs using get_current_screen()->add_help_tab().
 *
 * @since 1.3.0
 * @return void
 */
function hybrid_settings_page_help()
{
    /* Get the parent theme data. */
    $theme = hybrid_get_theme_data();
    /* If the theme has provided a documentation or support URI, add them to the help text. */
    if (!empty($theme['Documentation URI']) || !empty($theme['Support URI'])) {
        /* Open an unordered list for the help text. */
        $help = '<ul>';
        /* Add the Documentation URI. */
        if (!empty($theme['Documentation URI'])) {
            $help .= '<li><a href="' . esc_url($theme['Documentation URI']) . '">' . __('Documentation', 'hybrid-core') . '</a></li>';
        }
        /* Add the Support URI. */
        if (!empty($theme['Support URI'])) {
            $help .= '<li><a href="' . esc_url($theme['Support URI']) . '">' . __('Support', 'hybrid-core') . '</a></li>';
        }
        /* Close the unordered list for the help text. */
        $help .= '</ul>';
        /* Add a help tab with links for documentation and support. */
        get_current_screen()->add_help_tab(array('id' => 'default', 'title' => esc_attr($theme['Name']), 'content' => $help));
    }
}
示例#4
0
/**
 * Creates an information meta box with no settings about the theme. The meta box will display
 * information about both the parent theme and child theme. If a child theme is active, this function
 * will be called a second time.
 *
 * @since 1.2.0
 * @param $object Variable passed through the do_meta_boxes() call.
 * @param array $box Specific information about the meta box being loaded.
 */
function hybrid_meta_box_theme_display_about($object, $box)
{
    /* Get theme information. */
    $prefix = hybrid_get_prefix();
    $domain = hybrid_get_textdomain();
    /* Grab theme information for the parent theme. */
    if ('hybrid-core-about-theme' == $box['id']) {
        $theme_data = hybrid_get_theme_data();
    } elseif ('hybrid-core-about-child' == $box['id']) {
        $theme_data = hybrid_get_theme_data('stylesheet');
    }
    ?>

	<table class="form-table">
		<tr>
			<th>
				<?php 
    _e('Theme:', $domain);
    ?>
			</th>
			<td>
				<a href="<?php 
    echo $theme_data['URI'];
    ?>
" title="<?php 
    echo $theme_data['Title'];
    ?>
"><?php 
    echo $theme_data['Title'];
    ?>
</a>
			</td>
		</tr>
		<tr>
			<th>
				<?php 
    _e('Version:', $domain);
    ?>
			</th>
			<td>
				<?php 
    echo $theme_data['Version'];
    ?>
			</td>
		</tr>
		<tr>
			<th>
				<?php 
    _e('Author:', $domain);
    ?>
			</th>
			<td>
				<?php 
    echo $theme_data['Author'];
    ?>
			</td>
		</tr>
		<tr>
			<th>
				<?php 
    _e('Description:', $domain);
    ?>
			</th>
			<td>
				<?php 
    echo $theme_data['Description'];
    ?>
			</td>
		</tr>
	</table><!-- .form-table --><?php 
}
/**
 * Returns text for the contextual help tab on the theme settings page in the admin.  Theme authors can add 
 * a filter to the 'contextual_help' hook if they want to change the output of the help text.
 *
 * @since 1.2.0
 * @return string $help The contextual help text used on the theme settings page.
 */
function hybrid_settings_page_contextual_help()
{
    /* Set the $help variable to an empty string. */
    $help = '';
    /* Get the parent theme data. */
    $theme = hybrid_get_theme_data();
    /* If the theme has provided a documentation or support URI, add them to the help text. */
    if (!empty($theme['Documentation URI']) || !empty($theme['Support URI'])) {
        /* Open an unordered list for the help text. */
        $help = '<ul>';
        /* Add the Documentation URI. */
        if (!empty($theme['Documentation URI'])) {
            $help .= '<li><a href="' . esc_url($theme['Documentation URI']) . '">' . __('Documentation', hybrid_get_textdomain()) . '</a></li>';
        }
        /* Add the Support URI. */
        if (!empty($theme['Support URI'])) {
            $help .= '<li><a href="' . esc_url($theme['Support URI']) . '">' . __('Support', hybrid_get_textdomain()) . '</a></li>';
        }
        /* Close the unordered list for the help text. */
        $help .= '</ul>';
    }
    /* Return the contextual help text for this screen. */
    return $help;
}