Skip to content

Instantly share code, notes, and snippets.

@rickbutterfield
rickbutterfield / Foundation_Off_Canvas_Menu.php
Last active November 26, 2016 15:41
A custom walker to support Foundation 5's off-canvas nav in WordPress
<?php
/**
* FoundationNavWalker by rickbutterfield
* Now lives at https://github.com/rickbutterfield/FoundationNavWalker
*/
class FoundationNavWalker extends Walker_Nav_Menu {
public function start_lvl( &$output, $depth = 0, $args = array() ) {
@hissy
hissy / gist:6103177
Last active December 21, 2020 09:10
[WordPress] どうしても固定ページテンプレートでページ送り付きのアーカイブが作りたいのよと言う場合
<?php
/**
* Template Name: Archive Page */
?>
<?php
$paged = (int) get_query_var('paged');
$args = array(
'posts_per_page' => 3,
'paged' => $paged,
@hissy
hissy / gist:4740436
Last active December 12, 2015 07:58
[WordPress] wp_nav_menu のクラスに独自ルールを追加する
<?php
function nav_menu_class_customize($sorted_menu_items) {
foreach ($sorted_menu_items as $sorted_menu_item) {
// if menu item is a post type object (is not an archive or custom)
if ($sorted_menu_item->type == 'post_type') {
// get post object from object id
$post_obj = get_post($sorted_menu_item->object_id);
// rules
if ($post_obj->post_name == 'hoge') {
@wpsmith
wpsmith / wps_enqueue_lt_ie9.php
Created July 22, 2012 02:49
Conditionally Enqueue Script for IE browsers less than IE 9
<?php
add_action( 'wp_enqueue_scripts', 'wps_enqueue_lt_ie9' );
/**
* Conditionally Enqueue Script for IE browsers less than IE 9
*
* @link http://php.net/manual/en/function.version-compare.php
* @uses wp_check_browser_version()
*/
function wps_enqueue_lt_ie9() {
global $is_IE;
@hissy
hissy / wp-query-ref.php
Last active May 1, 2023 01:53 — forked from luetkemj/wp-query-ref.php
WP: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
* Japanese translated by hissy
*
* CODEX: http://wpdocs.sourceforge.jp/%E9%96%A2%E6%95%B0%E3%83%AA%E3%83%95%E3%82%A1%E3%83%AC%E3%83%B3%E3%82%B9/WP_Query#.E3.83.91.E3.83.A9.E3.83.A1.E3.83.BC.E3.82.BF
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
* Original: https://gist.github.com/luetkemj/2023628/9e911982440141a13cb1dd8ba1ad6b35cd7bbdd7
*/