如何在wordpress中的the_content()和the_excerpt()上设置字符限制?我只找到了字限制的解决方案 - 我希望能够设置输出的确切数量字符.
我正在尝试在Wordpress中设置包含自定义帖子类型和自定义分类的存档页面.
我创建了自定义帖子类型:"package"和自定义分类:"software".我的问题是,当我尝试查看localhost:8888/software/aperture时,我得到了类型包的所有帖子,而不仅仅是选择了自定义分类光圈的帖子.我使用以下代码:
<?php
$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
?>
<h1><?php echo $term->name;?> Presets</h1>
<div class="intro2">
<p>
<?php echo $term->description;?>
</p>
</div>
<?php query_posts('post_type=package'); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<!-- Product Start -->
<div class="product">
<div class="product_top"></div>
<div class="product_content">
<div class="product_image">
<a href="<?php the_permalink()?>">
<?php echo get_the_post_thumbnail( $id, $size, $attr ); ?>
</div>
<a href="<?php the_permalink()?>" class="title"><?php the_title()?></a>
<?php the_excerpt()?>
<div class="theprice">
<?php
$price = get_post_meta($post->ID, …Run Code Online (Sandbox Code Playgroud) 我正在使用wordpress,我想知道如何在使用时获得帖子类别的永久链接和名称:
<?php the_category() ?>
Run Code Online (Sandbox Code Playgroud)
上面输出一个列表,我只想在我自己的标记中包装永久链接和类别
我希望div #topmessage在用户第二次访问该网站时向下滑动.此外,当用户单击#close时,将不再显示该消息.我想我必须设置一个cookie并计算它但不确定如何.我有以下cookie插件与jquery一起安装http://plugins.jquery.com/files/jquery.cookie.js.txt
<script type="text/javascript">
jQuery(function($){
$('#topmessage').delay(1000).slideDown(400);
$("#close").click(function(){
$("#topmessage").slideToggle(400);
});
});
</script>
<div id="topmessage">
<a href="#" class="close" id="close">Close</a>
Hi welcome back, if you have any questions please feel free to <a href="/contact">contact me</a>.
</div>
Run Code Online (Sandbox Code Playgroud)
更新:我想这样做的原因是将div推送到访问过该网站一次的用户,现在又在另一个日期返回.我不只是想第二次加载网站时显示div,但它也必须在另一个日期或会话上.据我所知,无法访问cookie的创建日期?
我想在帖子上显示标签列表,但标签上没有链接.现在我使用:
<?php the_tags( '<li>', ', ', '</li>'); ?>
Run Code Online (Sandbox Code Playgroud)
如何从标签中删除链接?
所以这里是交易.我有一个div我希望第三次显示同一个用户点击一个按钮.我想将点击次数存储在Cookie中并计算点击次数.然后当第三次点击按钮时我想显示div.
我在我的网站上使用jquery已经使用这个http://plugins.jquery.com/files/jquery.cookie.js.txt 设置其他cookie,但我必须承认我是一个javascript newbee至少可以说
我有当前的作者ID存储在$theauthorid我想基于作者ID进行查询所以我这样做
query_posts('author=$theauthorid');
Run Code Online (Sandbox Code Playgroud)
但是,除非我手动编写id,否则它不起作用.我知道id正确存储,因为当我回复它时,我得到了正确的id.