Skip to content

Instantly share code, notes, and snippets.

@isotopie
isotopie / menu.php
Created May 15, 2016 11:42 — forked from coxmi/Menu.php
Custom wordpress menu: Get menu as hierarchical array with children
<?php
// is child of, recursive
function is_child_of( $post, $possible_parent_ID ) {
if ($post->ID == $possible_parent_ID) {
return true;
} elseif ($post->post_parent == 0) {
return false;
} else {
@isotopie
isotopie / get_post_id_by_meta_key_and_value.php
Created March 11, 2016 06:51 — forked from feedmeastraycat/get_post_id_by_meta_key_and_value.php
WordPress: Get post id by meta key and value
<?php
if (!function_exists('get_post_id_by_meta_key_and_value')) {
/**
* Get post id from meta key and value
* @param string $key
* @param mixed $value
* @return int|bool
* @author David M&aring;rtensson <david.martensson@gmail.com>
*/
function get_post_id_by_meta_key_and_value($key, $value) {