老谢博客

  • 首页
  • WordPress
  • 网络技术
  • 乱七八糟
  • 运维技术
  • 给我留言
  • 关于老谢

WordPress文章形式

分类:折腾日期:2014-05-06 - 17:53:10作者:老谢

官方关于文章形式帮助文档:http://codex.wordpress.org/zh-cn:文章形式

需要说明下的是在使用相册形式的时候,需要在循环体内加入下面的一句代码,以让可以使用自己定义的css样式

<?php add_filter( 'use_default_gallery_style', '__return_false' ); ?>

<?php add_filter( 'use_default_gallery_style', '__return_false' ); ?>

下面直接贴出我的loop.php以便大家参考:

<?php if ( has_post_format( 'status' )) { ?>
<div class="post<?php sticky_class(); ?>"  id="post-<?php the_ID(); ?>">
		<div class="post-data">
			<div class="title">
			<!--<h2><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>-->
			<h3 class="aside"><span>分类:<?php the_category(', '); ?></span><span>日期:<?php the_time('Y-m-d'); ?></span><span><span>作者:<?php the_author(); ?></span><span><?php if (function_exists('custom_the_views')) : ?>阅读:<?php custom_the_views($post->ID); ?></span><?php endif; ?>
			</h3>
			</div>
		</div>
		<div class="post-txt"><a href="<?php the_permalink() ?>" rel="bookmark"><?php echo get_avatar( get_the_author_meta('ID'), 42 ); ?></a><?php the_content(); ?></div>
</div>
<?php 
}else if ( has_post_format( 'gallery' ) ){ ?>
		<?php add_filter( 'use_default_gallery_style', '__return_false' );   ?>
<div class="post<?php sticky_class(); ?>"  id="post-<?php the_ID(); ?>">
		<div class="post-data">
			<div class="title">
			<!--<h2><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>-->
			<h3 class="aside"><span>标题:<?php echo the_title(); ?></span><span>分类:<?php the_category(', '); ?></span><span>日期:<?php the_time('Y-m-d'); ?></span><span><span>作者:<?php the_author(); ?></span><span><?php if (function_exists('custom_the_views')) : ?>阅读:<?php custom_the_views($post->ID); ?></span><?php endif; ?>
			</h3>
			</div>
		</div>
		<div class="post-txt"><?php echo do_shortcode('[gallery columns="3" size="thumbnail" link="file"]'); ?></div>
</div>
<?php 
}else{ ?>                      
<div class="post<?php sticky_class(); ?>"  id="post-<?php the_ID(); ?>">
		<div class="post-data">
			<div class="title">
			<h2><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
			<h3><span>分类:<?php the_category(', '); ?></span><span>日期:<?php the_time('Y-m-d'); ?></span><span>评论:<?php comments_popup_link(__('0条'), __('1条'), __('%条'), '', __('已关闭评论')); ?></span><span>作者:<?php the_author(); ?></span><span><?php if (function_exists('custom_the_views')) : ?>阅读:<?php custom_the_views($post->ID); ?></span><?php endif; ?>
			</h3>
			</div>
		</div>
		<div class="post-txt"><?php the_content( __( '<b>继续阅读...</b>') ); ?></div>
	    <?php the_tags('<div class="tags">Tags: ', ' , ', '</div>'); ?>
</div>
<?php } ?>

<?php if ( has_post_format( 'status' )) { ?> <div class="post<?php sticky_class(); ?>" id="post-<?php the_ID(); ?>"> <div class="post-data"> <div class="title"> <!--<h2><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>--> <h3 class="aside"><span>分类:<?php the_category(', '); ?></span><span>日期:<?php the_time('Y-m-d'); ?></span><span><span>作者:<?php the_author(); ?></span><span><?php if (function_exists('custom_the_views')) : ?>阅读:<?php custom_the_views($post->ID); ?></span><?php endif; ?> </h3> </div> </div> <div class="post-txt"><a href="<?php the_permalink() ?>" rel="bookmark"><?php echo get_avatar( get_the_author_meta('ID'), 42 ); ?></a><?php the_content(); ?></div> </div> <?php }else if ( has_post_format( 'gallery' ) ){ ?> <?php add_filter( 'use_default_gallery_style', '__return_false' ); ?> <div class="post<?php sticky_class(); ?>" id="post-<?php the_ID(); ?>"> <div class="post-data"> <div class="title"> <!--<h2><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>--> <h3 class="aside"><span>标题:<?php echo the_title(); ?></span><span>分类:<?php the_category(', '); ?></span><span>日期:<?php the_time('Y-m-d'); ?></span><span><span>作者:<?php the_author(); ?></span><span><?php if (function_exists('custom_the_views')) : ?>阅读:<?php custom_the_views($post->ID); ?></span><?php endif; ?> </h3> </div> </div> <div class="post-txt"><?php echo do_shortcode('[gallery columns="3" size="thumbnail" link="file"]'); ?></div> </div> <?php }else{ ?> <div class="post<?php sticky_class(); ?>" id="post-<?php the_ID(); ?>"> <div class="post-data"> <div class="title"> <h2><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2> <h3><span>分类:<?php the_category(', '); ?></span><span>日期:<?php the_time('Y-m-d'); ?></span><span>评论:<?php comments_popup_link(__('0条'), __('1条'), __('%条'), '', __('已关闭评论')); ?></span><span>作者:<?php the_author(); ?></span><span><?php if (function_exists('custom_the_views')) : ?>阅读:<?php custom_the_views($post->ID); ?></span><?php endif; ?> </h3> </div> </div> <div class="post-txt"><?php the_content( __( '<b>继续阅读...</b>') ); ?></div> <?php the_tags('<div class="tags">Tags: ', ' , ', '</div>'); ?> </div> <?php } ?>

原文地址 : https://www.xj123.info/4652.html

本站遵循 : 署名-非商业性使用-相同方式共享 2.5 中国大陆 (CC BY-NC-SA 2.5)

版权声明 : 原创文章转载时,请务必以超链接形式标明文章原始出处

Tags: WordPress
  • 上一篇:白色风车
  • 下一篇:WordPress自动升级要求填写FTP信息
2条评论
  1. 西门 说:

    我都没折腾主题的动力了

    POST:2014-05-13 22:04 回复
  2. 奇芳阁 说:

    如果我要实现 状态status形式的文章总在标准形式的下面怎么实现?意思就是第一篇是标准形式,第二个是状态,第三个是标准 这样的,但不能让状态的形式在第一个!

    POST:2015-01-27 18:31 回复
发表评论 点击取消评论.

*必填

*必填

  • 文章归档
  • 子网计算
  • 我的共享
  • 锻炼计划
  • 给我留言
  • 关于老谢
2023年 4月
一 二 三 四 五 六 日
 12
3456789
10111213141516
17181920212223
24252627282930
« 10月    

最新文章

  • 2021好久没更新博客
  • Zabbix监控oxidized备份状态
  • Zabbix 5.0 LTS版本MySQL表分区及编译安装随记
  • centos7.9部署oxidized自动备份交换机配置
  • Surface Pro 4更换屏幕与电池
  • VCSA中删除horizon view链接克隆生成的replica-受保护副本
  • Esxi6.7U3安装SanDisk Fusion-io 1.3T ioscale Pci SSD加速卡驱动
  • 搭建ELK日志系统分析处理fortigate的syslog日志
  • 华为USG防火墙配置NAT映射回流解决内网通过公网映射访问内部服务器
  • 飞塔防火墙fortitoken配置

最新评论

  • 无敌风火轮:和索尼没啥关系,这是索尼电脑的...
  • zhudong:老大,有VMware Horizon 7.12相关资...
  • qx:所有连接失效了,求一份
  • RainH:大佬,这个111.111.111.111是什么鬼?...
  • 王叨叨:幸福的人都是相似的,不幸的人各有各...
  • 李海博客:李海博客前来学习!
  • 明月登楼:最近使用了ZeroSSL证书,感觉还不...
  • 鸟叔:尽管不知道干啥的,还是来顶一下
  • 鸟叔:鸟叔来贵博客参观学习,通过十年之约穿...
  • 周良粥凉:往前看。

日志存档

  • 2021年10月
  • 2021年4月
  • 2021年3月
  • 2021年2月
  • 2020年11月
  • 2020年9月
  • 2020年5月
  • 2020年4月
  • 2020年3月
  • 2020年1月
  • 2019年12月
  • 2019年10月
  • 2019年7月
  • 2019年6月
  • 2019年5月
  • 2019年3月
  • 2019年1月
  • 2018年12月
  • 2018年11月
  • 2018年10月
  • 2018年7月
  • 2018年6月
  • 2018年5月
  • 2018年4月
  • 2018年3月
  • 2018年1月
  • 2017年10月
  • 2017年9月
  • 2017年8月
  • 2017年7月
  • 2017年2月
  • 2017年1月
  • 2016年12月
  • 2016年11月
  • 2016年10月
  • 2016年7月
  • 2016年6月
  • 2016年4月
  • 2016年2月
  • 2016年1月
  • 2015年12月
  • 2015年10月
  • 2015年9月
  • 2015年7月
  • 2015年5月
  • 2015年4月
  • 2015年3月
  • 2015年2月
  • 2015年1月
  • 2014年12月
  • 2014年10月
  • 2014年9月
  • 2014年8月
  • 2014年7月
  • 2014年6月
  • 2014年5月
  • 2014年4月
  • 2014年3月
  • 2014年2月
  • 2014年1月
  • 2013年12月
  • 2013年11月
  • 2013年10月
  • 2013年9月
  • 2013年8月
  • 2013年7月
  • 2013年6月
  • 2013年5月
  • 2013年4月
  • 2013年3月
  • 2013年2月
  • 2013年1月
  • 2012年12月
  • 2012年11月
  • 2012年9月
  • 2012年8月
  • 2012年7月
  • 2012年6月
  • 2012年5月
  • 2012年4月
  • 2012年3月
  • 2012年2月
  • 2012年1月
  • 2011年12月
  • 2011年11月
  • 2011年10月
  • 2011年9月
  • 2011年8月
  • 2011年7月
  • 2011年6月
  • 2011年5月
  • 2011年4月
  • 2011年3月
  • 2011年2月
  • 2011年1月
  • 2010年12月
  • 2010年11月
  • 2010年10月
  • 2010年9月
  • 2010年8月
  • 2010年7月

W3C

  • XHTML 1.0 Transitional
  • CSS level 3
  • Google+
Copyright © 2010-2023 老谢博客 All rights reserved.
Gzipped 76.5% | Optimized loading 59 queries in 0.262 seconds | Memory 33.48 MB | 皖ICP备13010663号-1
Powered by WordPress. | Hosted By 腾讯云 | Theme by WordPress主题巴士 | 站点地图 | SiteMap | Uptime | 技术支持:苏州天剑计算机系统有限公司