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


PHP post_password_required函数代码示例

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


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

示例1: twentysixteen_entry_meta

function twentysixteen_entry_meta()
{
    ob_start();
    if ('post' === get_post_type()) {
        ob_start();
        twentysixteen_entry_date();
        $postedOn = ob_get_clean();
        $author_avatar_size = apply_filters('twentysixteen_author_avatar_size', 49);
        printf('<div class="name-date"><div class="name"><span class="screen-reader-text">%2$s </span> <a class="url fn n" href="%3$s">%4$s</a></div><div class="date">%5$s</div></div><div class="avatar">%1$s</div>', get_avatar(get_the_author_meta('user_email'), $author_avatar_size), _x('Author', 'Used before post author name.', 'twentysixteen'), esc_url(get_author_posts_url(get_the_author_meta('ID'))), get_the_author(), $postedOn);
    }
    if (in_array(get_post_type(), array('attachment'))) {
        twentysixteen_entry_date();
    }
    $authordate = ob_get_clean();
    printf('<div class="author-date">%s</div>', $authordate);
    $format = get_post_format();
    if (current_theme_supports('post-formats', $format)) {
        printf('<span class="entry-format">%1$s<a href="%2$s">%3$s</a></span>', sprintf('<span class="screen-reader-text">%s </span>', _x('Format', 'Used before post format.', 'twentysixteen')), esc_url(get_post_format_link($format)), get_post_format_string($format));
    }
    echo '<div class="taxonomies">';
    if ('post' === get_post_type()) {
        twentysixteen_entry_taxonomies();
    }
    echo '</div>';
    if (!is_singular() && !post_password_required() && (comments_open() || get_comments_number())) {
        echo '<span class="comments-link">';
        comments_popup_link(sprintf(__('Leave a comment<span class="screen-reader-text"> on %s</span>', 'twentysixteen'), get_the_title()));
        echo '</span>';
    }
}
开发者ID:GamingGroupAachen,项目名称:wp-template-ggac-2,代码行数:30,代码来源:functions.php

示例2: tm_vals_blog_posted_on

 /**
  * Prints HTML with meta information for the current post-date/time and author.
  */
 function tm_vals_blog_posted_on()
 {
     $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
     if (get_the_time('U') !== get_the_modified_time('U')) {
         $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
     }
     $time_string = sprintf($time_string, esc_attr(get_the_date('c')), esc_html(get_the_date()), esc_attr(get_the_modified_date('c')), esc_html(get_the_modified_date()));
     // comments in header
     if (!is_single() && !post_password_required() && (comments_open() || get_comments_number())) {
         echo '<span class="comments-link">';
         comments_popup_link(esc_html__('Leave a comment', 'tm-vals-blog'), esc_html__('1', 'tm-vals-blog'), esc_html__('%', 'tm-vals-blog'));
         echo '</span>';
     }
     /*	$posted_on = sprintf(
     		esc_html_x( 'Posted on %s', 'post date', 'tm-vals-blog' ),
     		'<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
     	);
     
     	$byline = sprintf(
     		esc_html_x( 'by %s', 'post author', 'tm-vals-blog' ),
     		'<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span>'
     	);
     
     	echo '<span class="posted-on">' . $posted_on . '</span><span class="byline"> ' . $byline . '</span>'; // WPCS: XSS OK.
     */
 }
开发者ID:vfedushchin,项目名称:Tm-kursi-theme,代码行数:29,代码来源:template-tags.php

示例3: italystrap_excerpt_password_form

function italystrap_excerpt_password_form($excerpt)
{
    if (post_password_required()) {
        $excerpt = get_the_password_form();
    }
    return $excerpt;
}
开发者ID:AndrGelmini,项目名称:ItalyStrap,代码行数:7,代码来源:password_protection.php

示例4: base_post_thumbnail

    /**
     * Display the post thumbnail
     *
     * @return void
     */
    function base_post_thumbnail($postid)
    {
        if (post_password_required() || !has_post_thumbnail()) {
            return;
        }
        $format = get_post_format();
        if ($format == 'link') {
            $link_to = get_post_meta($postid, '_zilla_link_url', true);
        } else {
            $link_to = get_the_permalink($postid);
        }
        ?>

	<div class="entry-thumbnail">
	<?php 
        if (is_singular()) {
            the_post_thumbnail('full');
        } else {
            ?>
		<a href="<?php 
            echo esc_url($link_to);
            ?>
">
			<?php 
            the_post_thumbnail('blog-thumb');
            ?>
		</a>
	<?php 
        }
        ?>
	</div>

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

示例5: do_x_post_password_cb

 function do_x_post_password_cb()
 {
     //snag from wp-login.php:386-393
     require_once ABSPATH . 'wp-includes/class-phpass.php';
     // By default, use the portable hash from phpass
     $wp_hasher = new PasswordHash(8, true);
     // 10 days
     setcookie('wp-postpass_' . COOKIEHASH, $wp_hasher->HashPassword(stripslashes($_POST['pass'])), time() + 864000, COOKIEPATH);
     //fake it so it's available in the loop below
     $_COOKIE['wp-postpass_' . COOKIEHASH] = $wp_hasher->HashPassword(stripslashes($_POST['pass']));
     $q = new WP_Query("p={$_POST['pid']}");
     if ($q->have_posts()) {
         while ($q->have_posts()) {
             $q->the_post();
             // verifies password hash
             if (post_password_required()) {
                 wp_send_json_error('Invalid password');
             }
             // get post title
             ob_start();
             the_title(sprintf('<a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a>');
             $title = ob_get_clean();
             // get post content
             ob_start();
             the_content();
             $content = ob_get_clean();
         }
     }
     wp_reset_postdata();
     $return = array('title' => $title, 'content' => $content);
     wp_send_json_success($return);
 }
开发者ID:trepmal,项目名称:ajax-password-protected,代码行数:32,代码来源:ajax-password-protected.php

示例6: add_content

 public function add_content($content, $template, $position = 10)
 {
     if (!defined('ABSPATH')) {
         exit;
     }
     // Exit if accessed directly
     if (!in_the_loop()) {
         return;
     }
     // Return if not in main loop
     $content = '<div class="sp-post-content">' . $content . '</div>';
     ob_start();
     if ($position <= 0) {
         echo $content;
     }
     do_action('sportspress_before_single_' . $template);
     if (post_password_required()) {
         echo get_the_password_form();
         return;
     }
     if ($position > 0 && $position <= 5) {
         echo $content;
     }
     do_action('sportspress_single_' . $template . '_content');
     if ($position > 5 && $position <= 10) {
         echo $content;
     }
     do_action('sportspress_after_single_' . $template);
     if ($position > 10) {
         echo $content;
     }
     return ob_get_clean();
 }
开发者ID:ArnaudGuillou,项目名称:SiteESBVolley,代码行数:33,代码来源:class-sp-template-loader.php

示例7: build_output

 private function build_output($tag)
 {
     // More link
     if (!empty($this->params['catlink_tag'])) {
         if (!empty($this->params['catlink_class'])) {
             $this->lcp_output .= $this->get_category_link($this->params['catlink_tag'], $this->params['catlink_class']);
         } else {
             $this->lcp_output .= $this->get_category_link($this->params['catlink_tag']);
         }
     } else {
         $this->lcp_output .= $this->get_category_link("strong");
     }
     $this->lcp_output .= '<' . $tag;
     //Give a class to wrapper tag
     if (isset($this->params['class'])) {
         $this->lcp_output .= ' class="' . $this->params['class'] . '"';
     }
     //Give id to wrapper tag
     if (isset($this->params['instance'])) {
         $this->lcp_output .= ' id=lcp_instance_' . $this->params['instance'];
     }
     $this->lcp_output .= '>';
     $inner_tag = $tag == 'ul' ? 'li' : 'p';
     //Posts loop
     foreach ($this->catlist->get_categories_posts() as $single) {
         if (!post_password_required($single)) {
             $this->lcp_output .= $this->lcp_build_post($single, $inner_tag);
         }
     }
     //Close wrapper tag
     $this->lcp_output .= '</' . $tag . '>';
     // More link
     if (!empty($this->params['morelink_tag'])) {
         if (!empty($this->params['morelink_class'])) {
             $this->lcp_output .= $this->get_morelink($this->params['morelink_tag'], $this->params['morelink_class']);
         } else {
             $this->lcp_output .= $this->get_morelink($this->params['morelink_tag']);
         }
     } else {
         $this->lcp_output .= $this->get_morelink();
     }
     if (!empty($this->params['pagination']) && $this->params['pagination'] == "yes") {
         $lcp_paginator = '';
         $pages_count = ceil($this->catlist->get_posts_count() / $this->catlist->get_number_posts());
         for ($i = 1; $i <= $pages_count; $i++) {
             $lcp_paginator .= $this->lcp_page_link($i, true);
         }
         $this->lcp_output .= "<ul class='lcp_paginator'>";
         // Add "Previous" link
         if ($this->catlist->get_page() > 1) {
             $this->lcp_output .= $this->lcp_page_link(intval($this->catlist->get_page()) - 1, "<<");
         }
         $this->lcp_output .= $lcp_paginator;
         // Add "Next" link
         if ($this->catlist->get_page() < $pages_count) {
             $this->lcp_output .= $this->lcp_page_link(intval($this->catlist->get_page()) + 1, ">>");
         }
         $this->lcp_output .= "</ul>";
     }
 }
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:60,代码来源:CatListDisplayer.php

示例8: listable_entry_footer

 /**
  * Prints HTML with meta information for the categories, tags and comments.
  */
 function listable_entry_footer()
 {
     // Hide category and tag text for pages.
     if ('post' === get_post_type()) {
         /* translators: used between list items, there is a space after the comma */
         $categories_list = get_the_category_list(esc_html__(', ', 'listable'));
         if ($categories_list && listable_categorized_blog()) {
             printf('<span class="cat-links">' . esc_html__('Posted in %1$s', 'listable') . '</span>', $categories_list);
             // WPCS: XSS OK.
         }
         /* translators: used between list items, there is a space after the comma */
         $tags_list = get_the_tag_list('', esc_html__(', ', 'listable'));
         if ($tags_list) {
             printf('<span class="tags-links">' . esc_html__('Tagged %1$s', 'listable') . '</span>', $tags_list);
             // WPCS: XSS OK.
         }
     }
     if (!is_single() && !post_password_required() && (comments_open() || get_comments_number())) {
         echo '<span class="comments-link">';
         comments_popup_link(esc_html__('Leave a comment', 'listable'), esc_html__('1 Comment', 'listable'), esc_html__('% Comments', 'listable'));
         echo '</span>';
     }
     //
     //	edit_post_link(
     //		sprintf(
     //			/* translators: %s: Name of current post */
     //			esc_html__( 'Edit %s', 'listable' ),
     //			the_title( '<span class="screen-reader-text">"', '"</span>', false )
     //		),
     //		'<span class="edit-link">',
     //		'</span>'
     //	);
 }
开发者ID:swaroop42,项目名称:RockRose,代码行数:36,代码来源:template-tags.php

示例9: moderna_tag_comment

 /**
  * Prints HTML with meta information for the categories, tags and comments.
  */
 function moderna_tag_comment()
 {
     // Hide category and tag text for pages.
     if ('post' === get_post_type()) {
         /* translators: used between list items, there is a space after the comma */
         /*            $categories_list = get_the_category_list(esc_html__(', ', 'moderna'));
                       if ($categories_list && moderna_categorized_blog()) {
                           printf('<span class="cat-links">' . esc_html__('Posted in %1$s', 'moderna') . '</span>', $categories_list); // WPCS: XSS OK.
                       }*/
         /* translators: used between list items, there is a space after the comma */
         $tags_list = get_the_tag_list('', '<div style="float: left;">,&nbsp;</div>');
         printf('<li><i class="icon-folder-open"></i>' . esc_html__('%1$s', 'moderna') . '</li>', $tags_list);
         // WPCS: XSS OK.
     }
     if (!is_single() && !post_password_required() && (comments_open() || get_comments_number())) {
         echo '<li><i class="icon-comments"></i>';
         comments_popup_link(esc_html__('No comments', 'moderna'), esc_html__('1 Comment', 'moderna'), esc_html__('% Comments', 'moderna'));
         echo '</li>';
     }
     /*
                          edit_post_link(
                              sprintf(
                              // translators: %s: Name of current post
                                  esc_html__('Edit %s', 'moderna'),
                                  the_title('<span class="screen-reader-text">"', '"</span>', false)
                              ),
                              '<span class="edit-link">',
                              '</span>'
                          );*/
 }
开发者ID:nordcap,项目名称:wp_template_moderna,代码行数:33,代码来源:template-tags.php

示例10: atout_thumbnail

/**
* Display the post thumbnail if applicable 
* 
* @since Atout 1.0
*/
function atout_thumbnail()
{
    if (post_password_required() || is_attachment() || !has_post_thumbnail()) {
        return;
    }
    ?>

  <figure class="thumbnail">
      <?php 
    if (get_theme_mod('thumbnail_link') == 'yes') {
        ?>
        <a href="<?php 
        the_permalink();
        ?>
"><?php 
        the_post_thumbnail();
        ?>
</a>
      <?php 
    } else {
        the_post_thumbnail();
    }
    ?>
  </figure>
  <?php 
}
开发者ID:pbhanu1994,项目名称:bhanuprakash,代码行数:31,代码来源:template-tags.php

示例11: hacker_entry_footer

    /**
     * Prints HTML with meta information for the categories, tags and comments.
     */
    function hacker_entry_footer()
    {
        // Hide category and tag text for pages.
        ?>
	<div class="Article__meta pull-left">
	<?php 
        if ('post' === get_post_type()) {
            echo get_the_tag_list('<span class="post-tags"><i class="icon-tags"></i>', '', '</span>');
        }
        ?>
	</div>
	<!-- END .pull-left -->
	<div class="Article__meta pull-right">
	<?php 
        $post_id = get_the_ID();
        $likes = get_post_meta($post_id, '_likes', true);
        $likes = absint($likes);
        printf('<span><a href="#" class="js-rating" data-post="%1$s"><i class="icon-heart"></i><span class="js-count">%2$s</span></a></span>', $post_id, $likes);
        if (!post_password_required() && (comments_open() || get_comments_number())) {
            echo '<span><i class="icon-comments"></i><span>';
            comments_popup_link(esc_html__('No Comment', 'hacker'), esc_html__('1 Comment', 'hacker'), esc_html__('% Comments', 'hacker'));
            echo '</span></span>';
        }
        ?>
	</div>
	<!-- END .pull-right -->
<?php 
    }
开发者ID:yanvalue,项目名称:wordpress,代码行数:31,代码来源:template-tags.php

示例12: activetheme_post_thumbnail

    /**
     * TODO: PHPDoc
     */
    function activetheme_post_thumbnail()
    {
        if (post_password_required() || is_attachment() || !has_post_thumbnail()) {
            return;
        }
        if (is_single()) {
            ?>
	<div class="post-thumbnail">
	<?php 
            the_post_thumbnail('media-thumbnail', array('class' => 'img-responsive'));
            ?>
	</div>

	<?php 
        } else {
            ?>

        <a class="post-thumbnail" href="<?php 
            the_permalink();
            ?>
">
        <?php 
            the_post_thumbnail('media-thumbnail', array('class' => 'img-responsive'));
            ?>
        </a>
<?php 
        }
    }
开发者ID:TaylorFoster90,项目名称:Breton-Bay,代码行数:31,代码来源:posts.php

示例13: zatolab_post_classes

/**
 * Extend the default WordPress post classes.
 *
 * Adds a post class to denote:
 * Non-password protected page with a post thumbnail.
 *
 * @since Dichan 1.0
 *
 * @param array $classes A list of existing post class values.
 * @return array The filtered post class list.
 */
function zatolab_post_classes($classes)
{
    if (!post_password_required() && has_post_thumbnail()) {
        $classes[] = 'has-post-thumbnail';
    }
    return $classes;
}
开发者ID:webtechfreaky,项目名称:vienna-content-focused-personal-blog-theme,代码行数:18,代码来源:postclasses.php

示例14: staticboards_post_thumbnail

    function staticboards_post_thumbnail()
    {
        if (post_password_required() || is_attachment() || !has_post_thumbnail()) {
            return;
        }
        if (is_singular()) {
            ?>

        <div class="post-thumbnail">
        <?php 
            the_post_thumbnail('post-thumbnail', array('class' => 'img-fullwidth'));
            ?>
        </div><!-- .post-thumbnail -->

    <?php 
        } else {
            ?>

        <a class="post-thumbnail" href="<?php 
            the_permalink();
            ?>
" aria-hidden="true">
            <?php 
            the_post_thumbnail('post-thumbnail', array('class' => 'img-fullwidth', 'alt' => the_title_attribute('echo=0')));
            ?>
        </a>

    <?php 
        }
        // End is_singular()
    }
开发者ID:staticboards,项目名称:staticboards-wp-theme,代码行数:31,代码来源:structure.php

示例15: bbp_theme_before_topic_title

 static function bbp_theme_before_topic_title()
 {
     $topic_id = bbp_get_topic_id();
     if (post_password_required($topic_id)) {
         _e('<span class="protected_title_format">Protected:</span> ', 'bbpresskr');
     }
 }
开发者ID:082net,项目名称:bbpresskr,代码行数:7,代码来源:secret.php


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