隐藏自定义帖子以保护密码

时间:2014-12-22 23:24:44

标签: wordpress

我很想解决这个问题,我需要你的帮助......

我使用My wishlist插件生成自定义列表。我需要使用Wordpress中的函数使用密码保护此列表。

与预期的一样,自定义字段不会隐藏在帖子中,如您所见(这是测试版本) - > http://www.bubbledesign.org/PROVA/wish/lista-nozze-prova-1/

我尝试以各种方式应用包含在if语句中的post_password_required,但我是初学者,似乎没有任何工作..

有人可以帮助我吗?

谢谢你们

这是我需要隐藏的代码。它来自单个wishlist.php,我创建的模板文件输出列表:

<?php 
 **if ( !post_password_required() ) {**
//output the list
    $wishmeta = get_post_meta(get_the_ID(), 'my_wishes', true);
    foreach($wishmeta as $i => $meta):
?>
<div class="wishlist-item">
<h3><?php echo $meta['wishitem']; ?></h3>

<div class="wishlist-image-form">
<?php if($meta['wishdonorname'] != '' ||   $meta['wishdonoremail'] != ''): ?>
<?php if($wishlist_show_donor == "show"): ?>
<span class="wishlist-promised">Articolo prenotato da <?php echo $meta['wishdonorname']; ?>!</span><br />
<?php else: ?>
<span class="wishlist-promised">Articolo Prenotato!</span><br />
<?php endif; ?>
<?php endif; ?>

<?php if($meta['wishfilename'] != ''): ?>
<?php $thumb = wp_get_attachment_image_src( $meta['wishfilename'], 'medium'); ?>
<img src="<?php echo $thumb[0]; ?>" />
<br />
<?php endif; ?>

<?php if($meta['wishdonorname'] == '' && $meta['wishdonoremail'] == '' && $wishlist_show_form == "show"): ?>
Mi piacerebbe regalarvi questo articolo!  Dimmi come!
<form method="post" action="" class="wishlist-form">
<table>
<tr><td><span class="wishlist-form-label">Nome:</span></td><td><input name="wishdonorname" type="text" class="wishlist-form-input" /></td></tr>
<tr><td><span class="wishlist-form-label">Email:</span></td><td><input name="wishdonoremail" type="text" class="wishlist-form-input" /></td></tr>

<tr><td colspan="2" class="wishlist-double-span">

<input type="hidden" name="wishitem" value="<?php echo $meta['wishitem']; ?>" />
<input type="hidden" name="post_id" value="<?php the_ID(); ?>" />
<input type="hidden" name="wishindex" value="<?php echo $i; ?>" />
<input type="hidden" name="wish_donor_add_update" value="1" />
<input type="submit" value="Prenota" class="wishlist-form-submit-button" />
</td></tr>
</table>
</form>
<?php endif; ?>
</div>

<?php if($meta['wishprice'] != ''): ?>
<span class="wishlist-label">Prezzo:</span> <?php echo $meta['wishprice']; ?><br />
<?php endif; ?>

<?php if($meta['wishsize'] != ''): ?>
<span class="wishlist-label">Taglia:</span> <?php echo $meta['wishsize']; ?><br />
<?php endif; ?>

<?php if($meta['wishcolor'] != ''): ?>
<span class="wishlist-label">Colore:</span> <?php echo $meta['wishcolor']; ?><br />
<?php endif; ?>

<?php if($meta['wishstore'] != ''): ?>
<span class="wishlist-label">Disponibile da:</span> <?php echo $meta['wishstore']; ?>      <br />
<?php endif; ?>

<?php if($meta['wishlink'] != ''): ?>
<?php 
if(!stristr($meta['wishlink'], 'http://') && !stristr($meta['wishlink'], 'https://')) {
$meta['wishlink'] = 'http://'.$meta['wishlink'];
}
?>
<span class="wishlist-label">Link:</span> <a href="<?php echo $meta['wishlink']; ?>"><?php echo $meta['wishlink']; ?></a><br />
<?php endif; ?>


</div>
}

0 个答案:

没有答案