/** * Generates semantic classes for BODY element * * @param array $classes body classes */ function thematic_body_class($classes) { /** * Filter to control the theme layout * * Accepts any string that is part of thematic_available_theme_layouts(). Note that * the filter overrides the layout defined in the Theme Customizer. Any invalid * layout string will be ignored and the theme's default layout will be used. * * @see thematic_available_theme_layouts() * * @since 2.0.0 * * @param string $current_layout */ $current_layout = apply_filters('thematic_current_theme_layout', thematic_get_theme_opt('layout')); if (is_page_template('template-page-fullwidth.php')) { $classes[] = 'full-width'; } elseif (in_array($current_layout, thematic_available_layout_slugs())) { $classes[] = $current_layout; } else { $classes[] = thematic_default_theme_layout(); } if (thematic_is_legacy_xhtml()) { $classes[] = 'thematic-xhtml'; } /** * Filter the body classes * * @param array $classes */ return apply_filters('thematic_body_class', $classes); }
function test_xhtml_mode_set_by_upgrade() { // set pre-upgrade options $this->update_theme_option($this->pre_upgrade_opt); // run upgrade routine - function is hooked to admin_init thematic_opt_init(); $this->assertEquals('right-sidebar', thematic_get_theme_opt('layout')); $this->assertTrue(thematic_is_legacy_xhtml()); $this->delete_theme_option(); }
/** * Get the standard sidebar * * This includes the primary and secondary widget areas. * The sidebar can be switched on or off using thematic_sidebar. <br> * Default: ON <br> * * Filter: thematic_sidebar */ function thematic_sidebar() { $current_layout = apply_filters('thematic_current_theme_layout', thematic_get_theme_opt('layout')); if (in_array($current_layout, thematic_available_layout_slugs()) && 'full-width' == $current_layout) { $show = false; } else { $show = true; } $show = apply_filters('thematic_sidebar', $show); if ($show) { get_sidebar(); } return; }
/** * The Index loop * * Located in index.php * * Override: childtheme_override_index_loop */ function thematic_index_loop() { // Count the number of posts so we can insert a widgetized area $count = 1; while (have_posts()) { the_post(); // action hook for insterting content above #post thematic_abovepost(); ?> <div id="post-<?php the_ID(); ?> " <?php post_class(); ?> > <?php // creating the post header thematic_postheader(); ?> <div class="entry-content"> <?php thematic_content(); ?> <?php wp_link_pages(array('before' => sprintf('<div class="page-link">%s', __('Pages:', 'thematic')), 'after' => '</div>')); ?> </div><!-- .entry-content --> <?php thematic_postfooter(); ?> </div><!-- #post --> <?php // action hook for insterting content below #post thematic_belowpost(); comments_template(); if ($count == thematic_get_theme_opt('index_insert')) { get_sidebar('index-insert'); } $count = $count + 1; } }
/** * Display the footer text from theme options within the #siteinfo div * * Override: childtheme_override_siteinfo */ function thematic_siteinfo() { // footer text set in theme options echo "\t\t" . do_shortcode(thematic_get_theme_opt('footer_txt')) . "\n"; }
/** * The Index loop * * Located in index.php * * Override: childtheme_override_index_loop */ function thematic_index_loop() { // Count the number of posts so we can insert a widgetized area $count = 1; while (have_posts()) { the_post(); // action hook for insterting content above #post thematic_abovepost(); ?> <?php echo '<div id="post-' . get_the_ID() . '" '; // Checking for defined constant to enable Thematic's post classes if (!THEMATIC_COMPATIBLE_POST_CLASS) { post_class(); echo '>'; } else { echo 'class="'; thematic_post_class(); echo '">'; } // creating the post header thematic_postheader(); ?> <div class="entry-content"> <?php thematic_content(); ?> <?php wp_link_pages('before=<div class="page-link">' . __('Pages:', 'thematic') . '&after=</div>'); ?> </div><!-- .entry-content --> <?php thematic_postfooter(); ?> </div><!-- #post --> <?php // action hook for insterting content below #post thematic_belowpost(); comments_template(); if ($count == thematic_get_theme_opt('index_insert')) { get_sidebar('index-insert'); } $count = $count + 1; } }
*/ // calling the header.php get_header(); // action hook for placing content above #container thematic_abovecontainer(); // filter for manipulating the output of the #container opening element echo apply_filters('thematic_open_id_container', '<div id="container" class="content-wrapper">' . "\n\n"); // action hook for placing content above #content thematic_abovecontent(); echo apply_filters('thematic_open_id_content', '<div id="content" class="site-content" role="main">' . "\n\n"); // displays the page title thematic_page_title(); // create the navigation above the content thematic_navigation_above(); // display microformatted vCard if selected in Theme Options and display only on the first page of the archive's pagination if (thematic_get_theme_opt('author_info') == 1 & !is_paged()) { // setup the first post to acess the Author's metadata the_post(); ?> <div id="author-info" class="vcard"> <h2 class="entry-title"><?php the_author_meta('first_name'); ?> <?php the_author_meta('last_name'); ?> </h2> <?php
/** * Renders Legacy Options elements * * @since 1.0.0 */ function thematic_do_legacy_opt() { ?> <input id="thm_legacy_opt" type="checkbox" value="1" name="thematic_theme_opt[del_legacy_opt]" <?php checked(thematic_get_theme_opt('del_legacy_opt'), 1); ?> /> <?php $frameworkData = wp_get_theme(); $theme = $frameworkData->display('Name', false); ?> <label for="thm_legacy_opt"><?php printf(__('%s Theme Options have been upgraded to an improved format. Remove the legacy options from the database.', '{$current theme} Theme Options', 'thematic'), $theme); ?> </label> <?php }
function test_thematic_get_theme_opt_nonexisting_option() { $this->assertFalse(get_option('thematic_theme_opt')); $nonexisting_option = thematic_get_theme_opt('wacko'); $this->assertFalse($nonexisting_option); }
/** * Renders Leagcy Options elements * * @since Thematic 1.0 */ function thematic_do_legacy_opt() { ?> <input id="thm_legacy_opt" type="checkbox" value="1" name="thematic_theme_opt[del_legacy_opt]" <?php checked(thematic_get_theme_opt('del_legacy_opt'), 1); ?> /> <label for="thm_legacy_opt"><?php printf(__('%s Theme Options have been upgraded to an improved format. Remove the legacy options from the database.', 'thematic'), get_current_theme()); ?> </label> <?php }
/** * Determine if we want to use html5 or xhtml markup * * @return bool True for xhtml, false for html5 markup */ function thematic_is_legacy_xhtml() { // Child themes can set html5 markup if (current_theme_supports('thematic_html5')) { return false; } // Child themes can opt to use xhtml if (current_theme_supports('thematic_xhtml')) { return true; } // New 2.0 installations do not use the legacy mode by default if (0 == thematic_get_theme_opt('legacy_xhtml')) { return false; } return apply_filters('thematic_is_legacy_xhtml', true); }