当前位置: 首页>>代码示例>>PHP>>正文


PHP is_attachment函数代码示例

本文整理汇总了PHP中is_attachment函数的典型用法代码示例。如果您正苦于以下问题:PHP is_attachment函数的具体用法?PHP is_attachment怎么用?PHP is_attachment使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了is_attachment函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: foundation_post_nav_background

/**
 * Add featured image as background image to post navigation elements.
 *
 * @since Foundation Theme 0.5.0
 *
 * @see wp_add_inline_style()
 */
function foundation_post_nav_background()
{
    if (!is_single()) {
        return;
    }
    $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true);
    $next = get_adjacent_post(false, '', false);
    $css = '';
    if (is_attachment() && 'attachment' == $previous->post_type) {
        return;
    }
    if ($previous && has_post_thumbnail($previous->ID)) {
        $prevthumb = wp_get_attachment_image_src(get_post_thumbnail_id($previous->ID), 'post-thumbnail');
        $css .= '
                        .post-navigation .nav-previous { background-image: url(' . esc_url($prevthumb[0]) . '); }
                        .post-navigation .nav-previous .post-title, .post-navigation .nav-previous a:hover .post-title, .post-navigation .nav-previous .meta-nav { color: #fff; }
                        .post-navigation .nav-previous a:before { background-color: rgba(0, 0, 0, 0.4); }
                ';
    }
    if ($next && has_post_thumbnail($next->ID)) {
        $nextthumb = wp_get_attachment_image_src(get_post_thumbnail_id($next->ID), 'post-thumbnail');
        $css .= '
                        .post-navigation .nav-next { background-image: url(' . esc_url($nextthumb[0]) . '); border-top: 0; }
                        .post-navigation .nav-next .post-title, .post-navigation .nav-next a:hover .post-title, .post-navigation .nav-next .meta-nav { color: #fff; }
                        .post-navigation .nav-next a:before { background-color: rgba(0, 0, 0, 0.4); }
                ';
    }
    wp_add_inline_style('main-stylesheet', $css);
}
开发者ID:adam1920,项目名称:FoundationTheme,代码行数:36,代码来源:posts_navigation.php

示例2: activetheme_post_nav

    /**
     * Displays navigation to next/previous post when applicable.
    *
    * @since Twenty Thirteen 1.0
    *
    * @return void
    */
    function activetheme_post_nav()
    {
        global $post;
        // Don't print empty markup if there's nowhere to navigate.
        $previous = is_attachment() ? get_post($post->post_parent) : get_adjacent_post(false, '', true);
        $next = get_adjacent_post(false, '', false);
        if (!$next && !$previous) {
            return;
        }
        ?>
	<nav class="navigation post-navigation" role="navigation">
		<?php 
        /* <h1 class="screen-reader-text"><?php _e( 'Post navigation', 'activetheme' ); ?></h1> */
        ?>
		<div class="nav-links clearfix">
		
			<?php 
        if (is_singular('article')) {
            previous_post_link('%link', _x('<span class="meta-nav meta-nav-prev">&larr;</span> Previous Article', 'Previous article link', 'activetheme'));
            next_post_link('%link', _x('Next Article <span class="meta-nav meta-nav-next">&rarr;</span>', 'Next article link', 'activetheme'));
        } else {
            previous_post_link('%link', _x('<span class="meta-nav meta-nav-prev">&larr;</span> Previous Post', 'Previous post link', 'activetheme'));
            next_post_link('%link', _x('Next Post <span class="meta-nav meta-nav-next">&rarr;</span>', 'Next post link', 'activetheme'));
        }
        ?>

		</div><!-- .nav-links -->
	</nav><!-- .navigation -->
	<?php 
    }
开发者ID:TaylorFoster90,项目名称:Breton-Bay,代码行数:37,代码来源:pager.php

示例3: my_simone_post_nav

    /**
     * Display navigation to next/previous post when applicable.
     *
     * @return void
     */
    function my_simone_post_nav()
    {
        // Don't print empty markup if there's nowhere to navigate.
        $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true);
        $next = get_adjacent_post(false, '', false);
        if (!$next && !$previous) {
            return;
        }
        ?>
	<nav class="navigation post-navigation" role="navigation">
    <div class="post-nav-box clear">
        <h1 class="screen-reader-text"><?php 
        _e('Post navigation', 'my-simone');
        ?>
</h1>
        <div class="nav-links">
            <?php 
        previous_post_link('<div class="nav-previous"><div class="nav-indicator">' . _x('Previous Post:', 'Previous post', 'my-simone') . '</div><h1>%link</h1></div>', '%title');
        next_post_link('<div class="nav-next"><div class="nav-indicator">' . _x('Next Post:', 'Next post', 'my-simone') . '</div><h1>%link</h1></div>', '%title');
        ?>
        </div><!-- .nav-links -->
    </div><!-- .post-nav-box -->
</nav><!-- .navigation -->

			
	<?php 
    }
开发者ID:sintija,项目名称:wordpress_backup,代码行数:32,代码来源:template-tags.php

示例4: uncode_post_navigation

    /**
     * Display navigation to next/previous post when applicable.
     */
    function uncode_post_navigation($index_btn = '')
    {
        // Don't print empty markup if there's nowhere to navigate.
        $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true);
        $next = get_adjacent_post(false, '', false);
        if (!$next && !$previous) {
            return;
        }
        $output = '<nav class="post-navigation" role="navigation">
									<ul class="navigation">';
        $prev = get_previous_post_link('<li class="page-prev"><span class="btn-container">%link</span></li>', '<i class="fa fa-angle-left"></i><span>' . esc_html__('Prev', 'uncode') . '</span>');
        if ($prev !== '') {
            $output .= $prev;
        } else {
            $output .= '<li class="page-prev"><span class="btn-container"><span class="btn btn-link btn-icon-left btn-disable-hover"><i class="fa fa-angle-left"></i>' . esc_html__('Prev', 'uncode') . '</span></span></li>';
        }
        if ($index_btn !== '') {
            $output .= '<li class="nav-back"><span class="btn-container">' . $index_btn . '</span></li>';
        }
        $next = get_next_post_link('<li class="page-next"><span class="btn-container">%link</span></li>', '<span>' . esc_html__('Next', 'uncode') . '</span><i class="fa fa-angle-right"></i>');
        if ($next !== '') {
            $output .= $next;
        } else {
            $output .= '<li class="page-next"><span class="btn-container"><span class="btn btn-link btn-icon-right btn-disable-hover">' . esc_html__('Next', 'uncode') . '<i class="fa fa-angle-right"></i></span></span></li>';
        }
        $output .= '</ul><!-- .navigation -->
							</nav><!-- .post-navigation -->';
        return $output;
    }
开发者ID:b0123498765,项目名称:fithealthyandwealthy,代码行数:32,代码来源:template-tags.php

示例5: flat_post_nav

    function flat_post_nav()
    {
        global $post;
        $previous = is_attachment() ? get_post($post->post_parent) : get_adjacent_post(false, '', true);
        $next = get_adjacent_post(false, '', false);
        if (!$next && !$previous) {
            return;
        }
        ?>
			<nav class="navigation post-navigation" role="navigation">
					<h1 class="screen-reader-text"><?php 
        _e('Post navigation', 'flat');
        ?>
</h1>
					<div class="nav-links">

							<?php 
        previous_post_link('%link', _x('<span class="meta-nav">&larr;</span> %title', 'Previous post link', 'flat'));
        ?>
							<?php 
        next_post_link('%link', _x('%title <span class="meta-nav">&rarr;</span>', 'Next post link', 'flat'));
        ?>

					</div>
			</nav>
			<?php 
    }
开发者ID:pivaker,项目名称:driverschool,代码行数:27,代码来源:template-tags.php

示例6: zilla_content_width

 function zilla_content_width()
 {
     if (is_page_template('template-full-width.php') || is_attachment()) {
         global $content_width;
         $content_width = 940;
     }
 }
开发者ID:RetroMotion,项目名称:RetroMotion-Creative-Website,代码行数:7,代码来源:functions.php

示例7: oceanic_post_nav

    /**
     * Display navigation to next/previous post when applicable.
     */
    function oceanic_post_nav()
    {
        // Don't print empty markup if there's nowhere to navigate.
        $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true);
        $next = get_adjacent_post(false, '', false);
        if (!$next && !$previous) {
            return;
        }
        ?>
	<nav class="navigation post-navigation" role="navigation">
		<h1 class="screen-reader-text"><?php 
        _e('Post navigation', 'oceanic');
        ?>
</h1>
		<div class="nav-links">
			<?php 
        $slider_cats = get_theme_mod('oceanic-slider-cats', false);
        $slider_cat_ids = array();
        if ($slider_cats) {
            $slider_cats = explode(',', esc_html($slider_cats));
            for ($i = 0; $i < count($slider_cats); ++$i) {
                $cat_id = get_cat_ID($slider_cats[$i]);
                if ($cat_id > 0) {
                    $slider_cat_ids[$i] = $cat_id;
                }
            }
        }
        previous_post_link('<div class="nav-previous">%link</div>', _x('<span class="meta-nav">&larr;</span>&nbsp;%title', 'Previous post link', 'oceanic'), false, $slider_cat_ids);
        next_post_link('<div class="nav-next">%link</div>', _x('%title&nbsp;<span class="meta-nav">&rarr;</span>', 'Next post link', 'oceanic'), false, $slider_cat_ids);
        ?>
		</div><!-- .nav-links -->
	</nav><!-- .navigation -->
	<?php 
    }
开发者ID:neetudave,项目名称:heartfulness-uk,代码行数:37,代码来源:template-tags.php

示例8: display

 /**
  * Display breadcrumbs
  */
 public function display()
 {
     if (Habakiri::get('is_displaying_bread_crumb') === 'false') {
         return;
     }
     global $wp_query;
     // Set to home
     $home_label = $this->get_home_label();
     $this->set($home_label, home_url('/'));
     // Set to blog
     $post_type = $this->get_post_type();
     if (is_category() || is_tag() || is_date() || is_author() || is_single() && $post_type === 'post') {
         $show_on_front = get_option('show_on_front');
         $page_for_posts = get_option('page_for_posts');
         if ($show_on_front === 'page' && $page_for_posts) {
             $this->set(get_the_title($page_for_posts), get_permalink($page_for_posts));
         }
     }
     // Set current and ancestors
     if (is_404()) {
         $this->set_for_404();
     } elseif (is_search()) {
         $this->set_for_search();
     } elseif (is_tax()) {
         $this->set_for_tax();
     } elseif (is_attachment()) {
         $this->set_for_attachment();
     } elseif (is_page() && !is_front_page()) {
         $this->set_for_page();
     } elseif (is_post_type_archive()) {
         $this->set_for_post_type_archive();
     } elseif (is_single()) {
         $this->set_for_single();
     } elseif (is_category()) {
         $this->set_for_category();
     } elseif (is_tag()) {
         $this->set_for_tag();
     } elseif (is_author()) {
         $this->set_for_author();
     } elseif (is_day()) {
         $this->set_for_day();
     } elseif (is_month()) {
         $this->set_for_month();
     } elseif (is_year()) {
         $this->set_for_year();
     } elseif (is_home() && !is_front_page()) {
         $this->set_for_blog();
     }
     $bread_crumb = array();
     $last_item = array_pop($this->bread_crumb);
     foreach ($this->bread_crumb as $_bread_crumb) {
         if (!empty($_bread_crumb['link'])) {
             $bread_crumb[] = sprintf('<a href="%s">%s</a>', esc_url($_bread_crumb['link']), esc_html($_bread_crumb['title']));
         } else {
             $bread_crumb[] = esc_html($_bread_crumb['title']);
         }
     }
     $bread_crumb[] = sprintf('<strong>%s</strong>', $last_item['title']);
     printf('<div class="breadcrumbs">%s</div>', implode(' &gt; ', apply_filters('habakiri_bread_crumb', $bread_crumb)));
 }
开发者ID:ConductiveIO,项目名称:mbrady,代码行数:63,代码来源:class.breadcrumbs.php

示例9: writ_post_nav

    /**
     * Display navigation to next/previous post when applicable.
     *
     * @return void
     */
    function writ_post_nav()
    {
        // Don't print empty markup if there's nowhere to navigate.
        $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true);
        $next = get_adjacent_post(false, '', false);
        if (!$next && !$previous) {
            return;
        }
        ?>
	<nav class="navigation post-navigation" role="navigation">
		<h1 class="screen-reader-text"><?php 
        _e('Post navigation', 'writ');
        ?>
</h1>
		<div class="nav-links">

			<?php 
        previous_post_link('<div class="nav-previous">%link</div>', '<div class="arrow">' . _x('&larr;', 'Previous post link', 'writ') . '</div><div class="link">%title</div>');
        ?>
			<?php 
        next_post_link('<div class="nav-next">%link</div>', '<div class="arrow">' . _x('&rarr;', 'Next post link', 'writ') . '</div><div class="link">%title</div>');
        ?>

		</div><!-- .nav-links -->
	</nav><!-- .navigation -->
	<?php 
    }
开发者ID:partisan-collective,项目名称:partisan,代码行数:32,代码来源:template-tags.php

示例10: getWpTemplate

function getWpTemplate()
{
    if (defined('WP_USE_THEMES') && WP_USE_THEMES) {
        $template = false;
        if (is_404() && ($template = get_404_template())) {
        } elseif (is_search() && ($template = get_search_template())) {
        } elseif (is_tax() && ($template = get_taxonomy_template())) {
        } elseif (is_front_page() && ($template = get_front_page_template())) {
        } elseif (is_home() && ($template = get_home_template())) {
        } elseif (is_attachment() && ($template = get_attachment_template())) {
        } elseif (is_single() && ($template = get_single_template())) {
        } elseif (is_page() && ($template = get_page_template())) {
        } elseif (is_category() && ($template = get_category_template())) {
        } elseif (is_tag() && ($template = get_tag_template())) {
        } elseif (is_author() && ($template = get_author_template())) {
        } elseif (is_date() && ($template = get_date_template())) {
        } elseif (is_archive() && ($template = get_archive_template())) {
        } elseif (is_comments_popup() && ($template = get_comments_popup_template())) {
        } elseif (is_paged() && ($template = get_paged_template())) {
        } else {
            $template = get_index_template();
        }
        return str_replace(ABSPATH, '', $template);
    } else {
        return null;
    }
}
开发者ID:jtomeck,项目名称:jtwebfolio,代码行数:27,代码来源:showThemeFile.php

示例11: dln_template_blank_page

function dln_template_blank_page()
{
    if (is_page_template('page-templates/blank-page.php') || is_attachment() || !is_active_sidebar('sidebar-1')) {
        global $content_width;
        $content_width = 960;
    }
}
开发者ID:httvncoder,项目名称:151722441,代码行数:7,代码来源:functions.php

示例12: wpforge_adjust_content_width

 function wpforge_adjust_content_width()
 {
     global $content_width;
     if (is_page_template('full-width.php') || is_page_template('front-page.php') || is_attachment() || !is_active_sidebar('sidebar-1')) {
         $content_width = 1024;
     }
 }
开发者ID:sandrahe,项目名称:wp-forge,代码行数:7,代码来源:functions.php

示例13: apostrophe_post_nav

    /**
     * Display navigation to next/previous post when applicable.
     *
     * @return void
     */
    function apostrophe_post_nav()
    {
        // Don't print empty markup if there's nowhere to navigate.
        $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true);
        $next = get_adjacent_post(false, '', false);
        if (!$next && !$previous) {
            return;
        }
        ?>
		<nav class="navigation post-navigation" role="navigation">
		<h1 class="screen-reader-text"><?php 
        esc_html_e('Post navigation', 'apostrophe');
        ?>
</h1>
		<div class="nav-links">
			<div class="nav-previous">
			<?php 
        previous_post_link('%link', '<span class="meta-nav">' . _x('Previous', 'Previous post link', 'apostrophe') . '</span> <span class="apostrophe-post-title">%title</span>');
        ?>
			</div>
			<div class="nav-next">
				<?php 
        next_post_link('%link', '<span class="meta-nav">' . _x('Next', 'Next post link', 'apostrophe') . '</span> <span class="apostrophe-post-title">%title</span>');
        ?>
			</div>
		</div><!-- .nav-links -->
	</nav><!-- .navigation -->
	<?php 
    }
开发者ID:glugpace,项目名称:glugpace.org,代码行数:34,代码来源:template-tags.php

示例14: the_post_navigation

    /**
     * Display navigation to next/previous post when applicable.
     *
     * @todo Remove this function when WordPress 4.3 is released.
     */
    function the_post_navigation()
    {
        // Don't print empty markup if there's nowhere to navigate.
        $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true);
        $next = get_adjacent_post(false, '', false);
        if (!$next && !$previous) {
            return;
        }
        ?>
        <nav class="navigation post-navigation" role="navigation">
            <h2 class="screen-reader-text"><?php 
        _e('Post navigation', 'ncssm_sg');
        ?>
</h2>

            <div class="nav-links">
                <?php 
        previous_post_link('<div class="nav-previous">%link</div>', '%title');
        next_post_link('<div class="nav-next">%link</div>', '%title');
        ?>
            </div>
            <!-- .nav-links -->
        </nav><!-- .navigation -->
        <?php 
    }
开发者ID:ajspencer,项目名称:NCSSM-SG-WordPress,代码行数:30,代码来源:template-tags.php

示例15: bootstrapthreeminimal_custom_excerpt_more

/**
 * Adds a pretty "Continue Reading" link to custom post excerpts.
 */
function bootstrapthreeminimal_custom_excerpt_more($output)
{
    if (has_excerpt() && !is_attachment()) {
        $output .= bootstrapthreeminimal_continue_reading_link();
    }
    return $output;
}
开发者ID:aptiko,项目名称:wordpress-bootstrap3-minimal,代码行数:10,代码来源:functions.php


注:本文中的is_attachment函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。