Skip to content

Instantly share code, notes, and snippets.

@rynokins
rynokins / FontAwesome_5_WP_Admin.php
Last active November 7, 2018 22:07 — forked from daronspence/FontAwesome.php
Font Awesome 5 Wordpress Admin Icons
<?php
// Loads FontAwesome & assigns dashicon prefixed classes to correspond to FontAwesome 5 (free) fallbacks.
// This allows 'dashicons-' to be used when declaring custom post type icons.
// Added padding-top tweak to align better
// Pick your icon here: https://fontawesome.com/icons (make sure to search 'Free' icons)
function font_awesome_icons(){
echo '<link href="//use.fontawesome.com/releases/v5.5.0/css/all.css" rel="stylesheet">
<style>
.dashicons-before:before { font-family: dashicons, "Font Awesome 5 Free"; }
.dashicons-calendar-plus:before { padding-top:4px !important; content: "\f271"; }
@rynokins
rynokins / gist:d61a76c9d17bd7c2e84d980c932b016f
Created May 30, 2018 17:30 — forked from philcook/gist:15bd50aeb8f80315d2bcaa9720c45bbb
For creating conditional based logic for page or any children pages that are under a parent page.
function if_page_or_ancestor_page_is($page_slug = NULL)
{
$is_page = false;
if (is_page()) {
global $post;
/* Get an array of Ancestors and Parents if they exist */
$parents = get_post_ancestors($post->ID);
$all_pages = array_reverse(array_merge($parents, array($post->ID)));