wordpress

wordpress 禁用gravatar使用本地头像提高网页打开速度

  • 2016-5-3 08:37
  • 阅读(1507)
  • 评论(0)
  • WordPress默认的头像是读取gravatar.com上的图片的,对于国内用户来说会使网页打开速度变慢。所以我决定删除掉这块功能。修改get_avatar函数,在wp-includes/pluggable.php内。修改后的函数如下:代码如下: ?php if ...

    wordpress 禁用gravatar使用本地头像提高网页打开速度

    wordpress获取文章评论数及人数的方法

  • 2016-5-2 10:13
  • 阅读(1421)
  • 评论(1)
  • ?php /** * 获取文章的评论人数 *$postid:文章id *$which:返回类型(0或1)为0时返回评论人数,为1时返回评论条数 */ function count_comments($postid=0,$which=0) { $comments = get_comments('status=approvetype ...

    wordpress获取文章评论数及人数的方法

    wordpress判断语句

  • 2016-5-1 20:35
  • 阅读(1204)
  • 评论(0)
  • is_single()判断是否是具体文章的页面is_single('2')判断是否是具体文章(id=2)的页面is_single('Beef Stew')判断是否是具体文章(标题判断)的页面is_single('beef-stew')判断是否是具体文章(slug判断)的页面com ...

    wordpress判断语句

    wordpress 非插件调用评论表情的方法

  • 2016-4-30 21:02
  • 阅读(1249)
  • 评论(0)
  • !–smilies– ?php function wp_smilies() { global $wpsmiliestrans; if (!get_option('use_smilies') or ( empty($wpsmiliestrans))) return; $smilies = array_unique($wpsmiliestrans); $link = ''; foreach ($s ...

    wordpress 非插件调用评论表情的方法

    wordpress调用网站统计大全

  • 2016-4-29 08:41
  • 阅读(1184)
  • 评论(2)
  • 1、日志总数:?php $count_posts = wp_count_posts(); echo $published_posts = $count_posts-publish;?2、草稿数目:?php $count_posts = wp_count_posts(); echo $draft_posts = $count_posts-draft; ?3、评论总数 ...

    wordpress调用网站统计大全

    wordpress调用含gravatar头像的评论输出的方法

  • 2016-4-28 08:41
  • 阅读(1148)
  • 评论(2)
  • ?php global $wpdb; $sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID, comment_post_ID, comment_author, comment_date_gmt, comment_approved,comment_author_email, comment_type,comment_aut ...

    wordpress调用含gravatar头像的评论输出的方法

    wordpress去评论者链接的评论输出的方法

  • 2016-4-27 13:01
  • 阅读(1162)
  • 评论(2)
  • ?php global $wpdb; $sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID, comment_post_ID, comment_author, comment_date_gmt, comment_approved, comment_type,comment_author_url, SUBSTRING(co ...

    wordpress去评论者链接的评论输出的方法

    wordpress调用指定分类文章的方法

  • 2016-4-26 08:49
  • 阅读(1243)
  • 评论(0)
  • category=4 这里定义分类的IDnumberposts=10 这里定义要调取的条数 ?php $posts = get_posts( "category=4numberposts=10" ); ? ?php if( $posts ) : ? ul?php foreach( $posts as $post ) : setup_postdata( $post ...

    wordpress调用指定分类文章的方法

    wordpress调用相关文章的方法

  • 2016-4-22 08:37
  • 阅读(1243)
  • 评论(2)
  • 在文章页显示相关文章 ?php $tags = wp_get_post_tags($post-ID); if ($tags) { $first_tag = $tags-term_id; $args = array( 'tag__in' = array($first_tag), 'post__not_in' = array($post-ID), 'showposts' = 10, ...

    wordpress调用相关文章的方法

    wordpress调用最新留言的方法

  • 2016-4-21 10:38
  • 阅读(1083)
  • 评论(0)
  • 下面是我之前在一个Wordpress主题中代到的最新留言代码,具体也记不得是哪个主题了。该代码直接调用数据库显示一份最新留言。其中 LIMIT 10限制留言显示数量。绿色部份则是每条留言的输出样式。 ?php global $wpdb; ...

    wordpress调用最新留言的方法

    wordpress调用随机文章的方法

  • 2016-4-20 13:46
  • 阅读(1158)
  • 评论(0)
  • ?php $rand_posts = get_posts(‘numberposts=10orderby=rand’); foreach( $rand_posts as $post ) : ? !–下面是你想自定义的Loop– lia href=”?php the_permalink(); ?”?php the_title(); ?/a/li ?php endforea ...

    wordpress调用随机文章的方法

    wordpress调用最新文章的方法

  • 2016-4-19 08:30
  • 阅读(1265)
  • 评论(1)
  • WordPress最新文章的调用可以使用一行很简单的模板标签wp_get_archvies来实现. 代码如下:?php get_archives(‘postbypost’, 10); ? (显示10篇最新更新文章)或者?php wp_get_archives(‘type=postbypostlimit=20for ...

    wordpress调用最新文章的方法

    Wordpres各种标签调用合集

  • 2016-4-18 11:09
  • 阅读(1484)
  • 评论(1)
  • /%postname%/ 显示博客的自定义永久链接?php the_search_query(); ? 搜索表单的值?php _e(‘Message’); ? 打印输出信息?php wp_register(); ? 显示注册链接?php wp_loginout(); ? 显示登入/登出链接!–next page– ...

    Wordpres各种标签调用合集

    WordPress 主体模板 PHP代码引用说明

  • 2016-4-15 08:31
  • 阅读(1181)
  • 评论(0)
  • ?php the_content(); ? 日志内容?php if(have_posts()) : ? 确认是否有日志?php while(have_posts()) : the_post(); ? 如果有,则显示全部日志?php endwhile; ? 结束PHP函数”while”?php endif; ? 结束PHP函数”if ...

    WordPress 主体模板 PHP代码引用说明

    WordPress Header头部 PHP代码引用说明

  • 2016-4-14 15:38
  • 阅读(1093)
  • 评论(1)
  • 注: 也就是位于head和/head之间的PHP代码?php bloginfo(‘name’); ? 网站标题?php wp_title(); ? 日志或页面标题?php bloginfo(‘stylesheet_url’); ? WordPress主题样式表文件style.css的相对地址?php bloginfo( ...

    WordPress Header头部 PHP代码引用说明
    123下一页