function ct_body_classes($classes) { $template_dir = get_current_template(); $archive_team_str = strpos($template_dir, 'cals_teams/includes/templates/archive-team.php'); $single_team_str = strpos($template_dir, 'cals_teams/includes/templates/single-team.php'); //if current template is archive-team from plugin add class to body if ($archive_team_str !== false) { $fileName = rtrim(basename($template_dir), '.php'); $classes[] = 'cals_team-' . $fileName; return $classes; //if current template is single-team from plugin add class to body } else { if ($single_team_str !== false) { $fileName = rtrim(basename($template_dir), '.php'); $classes[] = 'cals_team-' . $fileName; return $classes; //default case } else { //$classes[] = 'class-name'; return $classes; } } }
/** * Outputs the widget * * @param array $args * @param array $instance * @return void */ public function widget($args, $instance) { $template = get_current_template(); // If not a page stop rendering if (!$template) { return false; } // Get template dir $dir = Sidebars::$sidebars[$template][$args['id']]['dir']; // If no fields exist stop rendering $fields = get_fields($instance['widget_id']); if (!$fields || !isset($fields['widget'])) { return false; } // Render the widgets foreach ($fields['widget'] as $widget) { echo Widgets::render($args, $widget, $dir); } }
</a> </div> <div class="overlay"> </div> <section class="detail-body"> <?php the_content(); ?> </section> <?php } else { ?> <?php if (get_current_template() == 'template-blog3.php') { ?> <div class="full-width-image hover-image"> <a href="<?php echo get_post_meta($post->ID, 'video-url', true); ?> " rel="prettyPhoto" title="<?php the_title(); ?> "><?php the_post_thumbnail('showcase-image'); ?> </a> </div>
/* * Always have wp_head() just before the closing </head> * tag of your theme, or you will break many plugins, which * generally use this hook to add elements to <head> such * as styles, scripts, and meta tags. */ wp_head(); ?> </head> <body <?php body_class(); ?> > <!-- <div><strong>Current template:</strong> <?php get_current_template(true); ?> </div> --> <div id="page" class="hfeed"> <header id="branding" role="banner"> <hgroup> <h1 id="site-title"><span><a href="<?php echo esc_url(get_page_link(1975)); ?> " rel="home"><?php bloginfo('name'); ?> </a></span></h1> <h2 id="site-description"><?php bloginfo('description'); ?>
function rad_help_footer() { if (is_user_logged_in()) { global $post; $output = ""; $output .= ' <div id="adminwidget"> <p class="center">Theme Helper</p> <ul> <li>ID: <strong>' . $post->ID . '</strong></li> <li>Content Type: <strong>'; if (is_front_page()) { $output .= "Front Page"; } if (is_home()) { $output .= "Home (blog)"; } if (is_single()) { $output .= "Single Post "; } if (is_page() && !is_front_page()) { $output .= "Page "; } if (is_category()) { $output .= "Category "; } if (is_tag()) { $output .= "Tag "; } if (is_tax()) { $output .= "Taxonomy "; } if (is_author()) { $output .= "Author "; } if (is_archive()) { $output .= "Archive "; } if (is_date()) { $output .= " - Date "; } if (is_year()) { $output .= " (year) "; } if (is_month()) { $output .= " (monthly) "; } if (is_day()) { $output .= " (daily) "; } if (is_time()) { $output .= " (time) "; } if (is_search()) { $output .= "Search "; } if (is_404()) { $output .= "404 "; } if (is_paged()) { $output .= " (Paged) "; } $output .= '</strong></li>'; $output .= '<li>True Condition(s): <strong>'; if (is_front_page()) { $output .= "is_front_page(), "; } if (is_home()) { $output .= "is_home()"; } if (is_single()) { $output .= "is_single(), "; } if (is_page()) { $output .= "is_page(), "; } if (is_singular()) { $output .= "is_singular() "; } if (is_category()) { $output .= "is_category(), "; } if (is_tag()) { $output .= "is_tag(), "; } if (is_tax()) { $output .= "is_tax(), "; } if (is_author()) { $output .= "is_author(), "; } if (is_post_type_archive()) { $output .= "is_post_type_archive(), "; } if (is_archive()) { $output .= "is_archive() "; } if (is_attachment()) { $output .= "is_attachment() "; } if (is_date()) { $output .= ", is_date() "; } if (is_year()) { $output .= ", is_year() "; } if (is_month()) { $output .= ", is_month() "; } if (is_day()) { $output .= ", is_day() "; } if (is_time()) { $output .= ", is_time() "; } if (is_search()) { $output .= "is_search() "; } if (is_404()) { $output .= "is_404() "; } if (is_paged()) { $output .= ", is_paged() "; } $output .= '</strong></li>'; $output .= '</strong><li>Post Type Slug: <strong>'; if (get_post_type()) { $output .= get_post_type(); } $output .= '</strong></li>'; if (isset($post->ID) && is_page() && get_post_meta($post->ID, '_wp_page_template', true)) { $output .= '<li>Template: <strong>' . get_post_meta($post->ID, '_wp_page_template', true) . '</strong></li> <li>Order: <strong>' . $post->menu_order . '</strong></li>'; } $output .= '<li style="color:#b65b02;font-weight:bold">File Loaded: <strong>' . get_current_template() . '</strong></li>'; $output .= '</ul><br />'; $output .= ' <p> <a href="' . site_url() . '/wp-admin/" class="strong">Admin Panel</a> / <a href="' . wp_logout_url(adminhelper_currenturl()) . '">Logout</a> </p> </div> '; } else { $output .= '<a id="adminwidget_login" title="Login to Wordpress" href="' . get_bloginfo('wpurl') . '/wp-login.php?redirect_to=' . urlencode(adminhelper_currenturl()) . '"></a>'; } echo $output; }