Hugh's Blog

谷歌地图绘制多个地点

官方就有很好的例子,具体开发还要找官方 api 文档,下面是一个简单的显示多个地点的例子。 <!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <title>Google Maps Multiple Markers</title> <script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script> </head> <body> <div id="map" style="width: 500px; height: 400px;"></div> <script type="text/javascript"> var locations = ...

使用 usort 函数对二维数组进行排序

PHP 提供了很多的排序函数,看了一下,好像没有对二维数组以上进行排序的函数,但是有一个 usort() 函数,可以使用用户自定义的函数 (也可以是匿名函数) 进行排 ...

 

WordPress 获取多个自定义分类法下的文章

主要还是使用 WP_Query 来获取,关键是 args 参数。 // 随便怎么写,反正能获取到 ids 或 slugs 就行 // 获取 post 下的要显示的分类 slug $category_value = get_post_meta($post->ID, 'tz_category_include', true); // 根据 slug 获取特定分类对象数组 $catObj = ...

 

WordPress 获取子页面

获取子页面很简单,代码也不长,需要注意的变量的传递问题。 代码 // get_page_children 方法 // 首先获取到需要的 pages // $query = new WP_Query(); // $pages = $query->query(array('post_type' => 'page', 'posts_per_page' => -1)); $pages = get_posts('post_type=page&posts_per_page=-1&orderby=date&order=DESC'); $page_children = get_page_children(get_the_ID(), $pages); // get_children 方法 $page_children ...

 

在 htaccess 文件中设置字符集

网站首页访问 index.html,显示是乱码。本来访问 index.php 文件是没问题的,所以可以在 apache 中使用 DirectoryIndex index.php index.html 来修改默认 index 文件,老严说可以使用 htaccess 文件来设置 ...

 
<< Newer Posts Older Posts >>