本文整理汇总了PHP中is_blog函数的典型用法代码示例。如果您正苦于以下问题:PHP is_blog函数的具体用法?PHP is_blog怎么用?PHP is_blog使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_blog函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_sidebar
function get_sidebar($post_id)
{
if (is_page()) {
$sidebar = $this->sidebar_names['page'];
}
if (is_front_page() || $post_id == theme_get_option('homepage', 'home_page')) {
$sidebar = $this->sidebar_names['home'];
}
if (is_blog()) {
$sidebar = $this->sidebar_names['blog'];
}
if (is_singular('post')) {
$sidebar = $this->sidebar_names['single'];
} elseif (is_singular('portfolio')) {
$sidebar = $this->sidebar_names['portfolio'];
}
if (is_search() || is_archive()) {
$sidebar = $this->sidebar_names['blog'];
}
if (!empty($post_id)) {
$custom = get_post_meta($post_id, '_sidebar', true);
if (!empty($custom)) {
$sidebar = $custom;
}
}
if (isset($sidebar)) {
dynamic_sidebar($sidebar);
}
}
示例2: fix_blog_link_on_cpt
function fix_blog_link_on_cpt($classes, $item, $args)
{
if (!is_blog()) {
$blog_page_id = intval(get_option('page_for_posts'));
if ($blog_page_id != 0 && $item->object_id == $blog_page_id) {
unset($classes[array_search('current_page_parent', $classes)]);
}
}
return $classes;
}
示例3: start_el
function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
{
global $wp_query;
$indent = $depth ? str_repeat("\t", $depth) : '';
$depth = $depth + 1;
$class_names = $value = '';
if (wt_get_option('general', 'menu_icons')) {
//$icons = '<i></i>';
//$icons_class = 'menu_icon ';
//$icons_list_class = ' icon_list ';
$icons = '';
$icons_class = '';
$icons_list_class = '';
} else {
$icons = '';
$icons_class = '';
$icons_list_class = '';
}
$classes = empty($item->classes) ? array() : (array) $item->classes;
$class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item));
$class_names = ' class="' . esc_attr($class_names) . $icons_list_class . ' level-' . $depth . '-li"';
$output .= $indent . '<li id="menu-item-' . $item->ID . '"' . $value . $class_names . '>';
$attributes = !empty($item->attr_title) ? ' title="' . esc_attr($item->attr_title) . '"' : '';
$attributes .= !empty($item->target) ? ' target="' . esc_attr($item->target) . '"' : '';
$attributes .= !empty($item->xfn) ? ' rel="' . esc_attr($item->xfn) . '"' : '';
$varpost = get_post($item->object_id);
if ($item->object == 'page') {
if (is_single() || is_archive() || is_page() || is_blog()) {
$attributes .= ' href="' . get_site_url() . '/#' . $varpost->post_name . '"';
} else {
$attributes .= ' href="#' . $varpost->post_name . '"';
}
} else {
$attributes .= !empty($item->url) ? ' href="' . esc_attr($item->url) . '"' : '';
}
if ($depth == 0) {
$item_output = $args->before;
$item_output .= '<a' . $attributes . ' class="' . $icons_class . 'level-' . $depth . '-a">' . $icons . '<span data-hover="' . $args->link_before . apply_filters('the_title', $item->title, $item->ID) . '">';
$item_output .= $args->link_before . apply_filters('the_title', $item->title, $item->ID);
$item_output .= '</span></a>';
$item_output .= $args->after;
} else {
$item_output = $args->before;
$item_output .= '<a' . $attributes . ' class="' . $icons_class . 'level-' . $depth . '-a">' . $icons . '<span data-hover="' . $args->link_before . apply_filters('the_title', $item->title, $item->ID) . '">';
$item_output .= $args->link_before . apply_filters('the_title', $item->title, $item->ID);
$item_output .= '</span></a>';
$item_output .= $args->after;
}
$output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args);
}
示例4: my_neat_body_class
function my_neat_body_class($classes)
{
if (in_array('page-template-nxnw-templates', $classes) || is_404()) {
$classes[] = 'nxnw-template';
} elseif (is_blog() || is_search() || is_archive() || is_single()) {
$classes[] = 'nxnw-template blog';
} elseif (is_page_template('pf-templates/template-financial-aid.php')) {
$classes[] = 'pf-template no-sidebars';
} else {
$classes[] = 'pf-template';
}
return $classes;
}
示例5: thinkup_frontscripts
function thinkup_frontscripts()
{
/* Add jQuery library. */
wp_enqueue_script('jquery-masonry');
// Register theme stylesheets.
wp_register_style('responsive', get_template_directory_uri() . '/styles/style-responsive.css', '', '1.1');
wp_register_style('sidebarleft', get_template_directory_uri() . '/styles/layouts/thinkup-left-sidebar.css', '', '1.1');
wp_register_style('sidebarright', get_template_directory_uri() . '/styles/layouts/thinkup-right-sidebar.css', '', '1.1');
// Add theme stylesheets.
wp_enqueue_style('bootstrap', get_template_directory_uri() . '/lib/extentions/bootstrap/css/bootstrap.min.css', '', '2.3.2');
wp_enqueue_style('style', get_stylesheet_uri(), '', '1.5.6');
wp_enqueue_style('shortcodes', get_template_directory_uri() . '/styles/style-shortcodes.css', '', '1.1');
// Add Font Packages.
wp_enqueue_style('font-awesome-min', get_template_directory_uri() . '/lib/extentions/font-awesome/css/font-awesome.min.css', '', '3.2.1');
wp_enqueue_style('font-awesome-cdn', '//netdna.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css', '', '4.2.0');
wp_enqueue_style('elusive-min', get_template_directory_uri() . '/lib/extentions/elusive-icons/elusive-webfont.css', '', '2.0');
// Add theme scripts
wp_enqueue_script('frontend', get_template_directory_uri() . '/lib/scripts/main-frontend.js', array('jquery'), '1.1', true);
wp_enqueue_script('bootstrap', get_template_directory_uri() . '/lib/extentions/bootstrap/js/bootstrap.js', array('jquery'), '2.3.2', true);
wp_enqueue_script('modernizr', get_template_directory_uri() . '/lib/scripts/modernizr.js', array('jquery'), '', true);
// Register Retina script - Enqueued in 01.general-settings.php
wp_register_script('retina', get_template_directory_uri() . '/lib/scripts/retina.js', array('jquery'), '0.0.2', '', true);
// Add Blog scripts
if (is_blog()) {
wp_enqueue_script('jquery-masonry');
wp_enqueue_script('imagesloaded', get_template_directory_uri() . '/lib/scripts/plugins/imagesloaded/imagesloaded.js', array('jquery'), '3.1.4', true);
}
if (is_singular() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
// Add ThinkUpSlider scripts
if (is_front_page()) {
wp_enqueue_script('thinkupslider', get_template_directory_uri() . '/lib/scripts/plugins/ResponsiveSlides/responsiveslides.min.js', array('jquery'), '1.54');
wp_enqueue_script('thinkupslider-call', get_template_directory_uri() . '/lib/scripts/plugins/ResponsiveSlides/responsiveslides-call.js', array('jquery'));
}
}
示例6: get_option
<?php
//Vars
$page_for_posts = get_option('page_for_posts');
$postid = get_the_ID();
$item_id = is_blog() ? $page_for_posts : $postid;
$first_block_background_color = get_sub_field('first_block_background_color', $item_id) ? 'background-color: ' . get_sub_field('first_block_background_color', $item_id) . '; ' : '';
$first_block_text_color = get_sub_field('first_block_text_color', $item_id) ? 'color: ' . get_sub_field('first_block_text_color', $item_id) . '; ' : '';
$block_background_color = get_sub_field('block_background_color', $item_id) ? 'background-color: ' . get_sub_field('block_background_color', $item_id) . '; ' : '';
$block_text_color = get_sub_field('block_text_color', $item_id) ? 'color: ' . get_sub_field('block_text_color', $item_id) . '; ' : '';
$first_block_intro_text = get_sub_field('first_block_intro_text', $item_id) ? get_sub_field('first_block_intro_text', $item_id) : '';
$extra_class = get_sub_field('extra_class', $item_id) ? get_sub_field('extra_class', $item_id) : '';
$first_block_styles = 'style="' . $first_block_background_color . $first_block_text_color . '"';
$block_styles = 'style="' . $block_background_color . $block_text_color . '"';
?>
<?php
$args1 = array('post_type' => array('position'));
$query1 = new WP_Query($args1);
if ($query1->have_posts()) {
?>
<div class="positions">
<div class="position-block">
<div class="position-block-inner" <?php
echo $first_block_styles;
?>
>
<h2><?php
echo $first_block_intro_text;
?>
</h2>
示例7: thinkup_title_select
function thinkup_title_select()
{
global $post;
if (is_page()) {
printf(__('%s', 'lan-thinkupthemes'), get_the_title());
} elseif (is_attachment()) {
printf(__('Blog Post Image: %s', 'lan-thinkupthemes'), esc_attr(get_the_title($post->post_parent)));
} else {
if (is_single()) {
printf(__('%s', 'lan-thinkupthemes'), get_the_title());
} else {
if (is_search()) {
printf(__('Search Results: %s', 'lan-thinkupthemes'), get_search_query());
} else {
if (is_404()) {
printf(__('Page Not Found', 'lan-thinkupthemes'));
} else {
if (is_category()) {
printf(__('Category Archives: %s', 'lan-thinkupthemes'), single_cat_title('', false));
} elseif (is_tag()) {
printf(__('Tag Archives: %s', 'lan-thinkupthemes'), single_tag_title('', false));
} elseif (is_author()) {
the_post();
printf(__('Author Archives: %s', 'lan-thinkupthemes'), get_the_author());
rewind_posts();
} elseif (is_day()) {
printf(__('Daily Archives: %s', 'lan-thinkupthemes'), get_the_date());
} elseif (is_month()) {
printf(__('Monthly Archives: %s', 'lan-thinkupthemes'), get_the_date('F Y'));
} elseif (is_year()) {
printf(__('Yearly Archives: %s', 'lan-thinkupthemes'), get_the_date('Y'));
} elseif (is_post_type_archive('portfolio')) {
printf(__('Portfolio', 'lan-thinkupthemes'));
} elseif (is_blog()) {
printf(__('Blog', 'lan-thinkupthemes'));
} else {
printf(__('%s', 'lan-thinkupthemes'), get_the_title());
}
}
}
}
}
}
示例8: hanna_body_classes
function hanna_body_classes($classes)
{
$theme_options = get_theme_mod('zilla_theme_options');
if (is_blog() && is_layout_standard()) {
$classes[] = 'layout-standard';
}
return $classes;
}
示例9: config
$page = $page ? (int) $page : 1;
$perpage = config('posts.perpage');
$posts = get_posts(null, $page, $perpage);
$total = '';
$tl = blog_tagline();
if ($tl) {
$tagline = ' - ' . $tl;
} else {
$tagline = '';
}
if (empty($posts) || $page < 1) {
// a non-existing page
render('no-posts', array('title' => 'Blog - ' . blog_title(), 'description' => blog_title() . ' Blog Homepage', 'canonical' => site_url(), 'bodyclass' => 'noposts', 'is_front' => is_front(true)));
die;
}
render('main', array('title' => 'Blog - ' . blog_title(), 'description' => blog_title() . ' Blog Homepage', 'canonical' => site_url() . 'blog', 'page' => $page, 'posts' => $posts, 'bodyclass' => 'inblog', 'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> » Blog', 'pagination' => has_pagination($total, $perpage, $page), 'is_blog' => is_blog(true)));
} else {
if (config("views.counter") != "true") {
if (!login()) {
file_cache($_SERVER['REQUEST_URI']);
}
}
$post = get_static_post($static);
if (!$post) {
not_found();
}
$post = $post[0];
if (config("views.counter") == "true") {
add_view($post->file);
if (!login()) {
file_cache($_SERVER['REQUEST_URI']);
示例10: get_template_part
<aside id="sidebar" role="complementary" itemscope="itemscope" itemtype="http://schema.org/WPSideBar">
<?php
if (is_author()) {
?>
<?php
get_template_part('sidebar-city');
?>
<?php
//dynamic_sidebar( 'sidebar-author' ); echo "<div>TIJMEN IS TOF</div>";
?>
<?php
} elseif (is_blog()) {
?>
<?php
dynamic_sidebar('sidebar-blog');
?>
<?php
$images = get_field('images');
if ($images) {
?>
<h3>Photos</h3>
<ul class="galleria">
<?php
foreach ($images as $image) {
?>
<img data-jslghtbx="<?php
示例11: wt_blog_featured_image
function wt_blog_featured_image($type = 'full', $layout = '', $set_width = '', $set_height = '')
{
$image_src_array = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full', true);
if ($layout == 'full') {
$width = 1140;
$left_width = 720;
// content width under 991px where the image is displayed at full size
} elseif (is_numeric($layout)) {
$width = $layout;
$left_width = $width;
} else {
$width = 848;
$left_width = 720;
// main content width under 991px where the image is displayed at full size
}
if ($type == 'left') {
if ($layout == 'full') {
$inline_width = wt_get_option('blog', 'left_width');
// Full Layout - left image inline width
$height = wt_get_option('blog', 'left_image_height');
} else {
$inline_width = wt_get_option('blog', 'sidebar_left_width');
// Sidebar Layout - left image inline width
$height = wt_get_option('blog', 'sidebar_left_image_height');
}
} else {
$adaptive_height = wt_get_option('blog', 'adaptive_height');
$single_adaptive_height = wt_get_option('blog', 'single_adaptive_height');
if ($adaptive_height && is_blog()) {
$height = floor($width * ($image_src_array[2] / $image_src_array[1]));
} elseif ($single_adaptive_height && is_single()) {
$height = floor($width * ($image_src_array[2] / $image_src_array[1]));
} else {
if ($layout == 'full') {
$height = wt_get_option('blog', 'image_height');
} else {
$height = wt_get_option('blog', 'sidebar_image_height');
}
}
}
// If width / height are set by default when function is called
if ($set_width != '') {
$width = $set_width;
}
if ($set_height != '') {
$height = $set_height;
}
if ($type == 'left') {
$width = $left_width;
// The full width of the image
}
$image_src = aq_resize(wt_get_image_src($image_src_array[0]), $width, $height, true);
//resize & crop img
$output = '';
if (has_post_thumbnail()) {
$output .= '<div class="wt_image_frame entry_image">';
$output .= '<span class="wt_image_holder"';
if ($type == 'left') {
$output .= ' style="width:' . $inline_width . 'px"';
}
$output .= '>';
if (is_single()) {
if (wt_get_option('blog', 'featured_image_lightbox')) {
$output .= '<a class="overlay_zoom" href="' . $image_src_array[0] . '" title="' . get_the_title() . '" data-rel="lightbox">';
$output .= '<img src="' . $image_src . '" alt="' . get_the_title() . '" width="' . $width . '" height="' . $height . '" />';
$output .= '</a>';
} else {
$output .= '<img src="' . $image_src . '" alt="' . get_the_title() . '" width="' . $width . '" height="' . $height . '" />';
}
} else {
$output .= '<a class="overlay_zoom" href="' . get_permalink() . '" title="">';
$output .= '<img src="' . $image_src . '" alt="' . get_the_title() . '" width="' . $width . '" height="' . $height . '" />';
$output .= '</a>';
}
$output .= '</span>';
$output .= '</div>';
}
return $output;
}
示例12: array
// Set up base array. Fill out later for current page.
$page_array = array("isspecial" => false, "isreal" => false, "slug" => $page, "title" => "", "body" => "", "html" => "", "excerpt" => "", "lastupdate" => 0, "created" => 0, "isblog" => false, "tags" => array(), "childs" => array(), "blogposts" => array());
$message = array();
/// Special Pages ///////////////////
if ($page == "all") {
// Get all pages and merge special data with page array
$page_array = array_merge($page_array, array("isspecial" => true, "title" => "All pages", "html" => "", "childs" => $db->select_rows("SELECT slug,title,excerpt FROM pages ORDER BY title ASC")));
} else {
if ($page == "blog") {
$blogs = $db->select_rows("SELECT slug,title,body,excerpt,created FROM blog ORDER BY created DESC");
$page_array = array_merge(array_merge($page_array, array_shift($blogs)), array("isblog" => true, "isspecial" => true, "blogposts" => $blogs));
}
}
/// Regular Pages ///////////////////
if (!$page_array["isspecial"]) {
$page_array["isblog"] = is_blog($page);
$page_escape = mysql_real_escape_string($page);
$table = $page_array["isblog"] ? "blog" : "pages";
// Merge with $page_array
if ($newarray = $db->select_row("SELECT * FROM {$table} WHERE slug='{$page_escape}' LIMIT 1")) {
$page_array = array_merge($page_array, $newarray);
}
// Page if database result carries a lastupdate variable
$page_array["isreal"] = $page_array["isblog"] ? $page_array["created"] != 0 : $page_array["lastupdate"] != 0;
// Pages can exist without being in the database,
// If they exist in database:
if ($page_array["isreal"]) {
// SQL returns the tags as array(array("tag" => "page1"), array("tag" => "page2"));
// So place each value of "tag" into a new array
$page_array["tags"] = array_place('$v[tag]', $db->select_rows("SELECT tag FROM pages_tags WHERE slug='{$page_escape}' ORDER BY tag"));
}
示例13: elseif
<?php
global $hnmOpt;
?>
<div class="inner-banner">
<?php
if (has_post_thumbnail() && !is_blog()) {
the_post_thumbnail('full');
} else {
echo '<img src="' . esc_url($hnmOpt['page_img']['url']) . '" alt="" />';
}
?>
<div class="container">
<div class="row">
<h2>
<?php
if (is_home()) {
echo _x('Blog', 'blog page title', 'health-plus');
} elseif (is_archive()) {
echo _x('Archive', 'archive page title', 'health-plus');
} elseif (is_search()) {
echo _x('Search', 'search page title', 'health-plus');
} elseif (is_404()) {
echo _x('404 Not Found', 'error page title', 'health-plus');
} else {
the_title();
}
?>
</h2>
示例14:
<?php
if (is_sidebar_page() === true) {
?>
<div id="main-sidebar">
<?php
if (is_blog()) {
/* Blog Sidebar */
if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Blog Sidebar')) {
}
} else {
/* Page Sidebar */
if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Main Sidebar')) {
}
}
?>
</div>
<?php
}
示例15: get_option
<header class="page-header wow fadeInUp" data-wow-delay="0.5s" <?php
$page_for_posts = get_option('page_for_posts');
$postid = get_the_ID();
$item_id = is_blog() ? $page_for_posts : $postid;
$header_item_direction = is_blog() ? get_field('header_item_direction', $page_for_posts) : get_field('header_item_direction');
$header_item_distribution = is_blog() ? get_field('header_item_distribution', $page_for_posts) : get_field('header_item_distribution');
$header_item_alignment = is_blog() ? get_field('header_item_alignment', $page_for_posts) : get_field('header_item_alignment');
$add_background_video = is_blog() ? get_field('add_background_video', $page_for_posts) : get_field('add_background_video');
$video_mp4 = is_blog() ? get_field('video_mp4', $page_for_posts) : get_field('video_mp4');
$video_ogg = is_blog() ? get_field('video_ogg', $page_for_posts) : get_field('video_ogg');
$video_webm = is_blog() ? get_field('video_webm ', $page_for_posts) : get_field('video_webm ');
$video_placeholder_image = is_blog() ? get_field('video_placeholder_image', $page_for_posts) : get_field('video_placeholder_image');
$background_image = is_blog() ? get_field('background_image', $page_for_posts) : get_field('background_image');
if ($add_background_video == 0 && $background_image) {
echo 'style="background: url(' . $background_image . ') center no-repeat; background-size: cover;"';
}
$detect = new Mobile_Detect();
?>
>
<?php
if (!$detect->isMobile() && $add_background_video == 1) {
?>
<div class="header-bg-video bg-video">
<video autoplay loop poster="<?php
echo $video_placeholder_image;
?>
" class="bgvid">
<source src="<?php
echo $video_webm;
?>
" type="video/webm">