Skip to content

Instantly share code, notes, and snippets.

@lw-na
lw-na / basic-dropdown-usage.php
Created May 12, 2020 13:28 — forked from joshuadavidnelson/basic-dropdown-usage.php
Filter wp_dropdown_categories by post type.
<?php
/**
* Using wp_dropdown_categories with the post type filter applied.
*
* @link https://joshuadnelson.com/category-taxonomy-dropdown-filtered-by-post-type/
*/
// Taxonomy dropdown arguments
$args = array(
'taxonomy' => 'department',
@lw-na
lw-na / functions.php
Created August 27, 2020 09:51 — forked from alexander-young/functions.php
Defer Javascript in WordPress
function defer_parsing_of_js($url)
{
if (is_admin()) return $url; //don't break WP Admin
if (false === strpos($url, '.js')) return $url;
if (strpos($url, 'jquery.js')) return $url;
return str_replace(' src', ' defer src', $url);
}
add_filter('script_loader_tag', 'defer_parsing_of_js', 10);
@lw-na
lw-na / dashboard-activity-cpt.php
Created April 2, 2021 20:36 — forked from Mte90/dashboard-activity-cpt.php
Add your cpts to the Widget Activity of the Dashboard in WordPress
<?php
/*
Plugin Name: Dashboard Widget Activity Custom Post Type
Plugin URI:
Description:
Author: Daniele Mte90 Scasciafratte
Version: 1.0.0
Author URI: http://mte90.net
*/