Skip to content

Instantly share code, notes, and snippets.

View Kevinlearynet's full-sized avatar

Kevinleary.net Kevinlearynet

View GitHub Profile
@Kevinlearynet
Kevinlearynet / media-types-filter.js
Last active June 23, 2021 16:13 — forked from danielbachhuber/collection-filter.js
Add a custom taxonomy dropdown filter to the WordPress Media Library
(function(){
/**
* Create a new MediaLibraryTaxonomyFilter we later will instantiate
*/
var MediaLibraryTaxonomyFilter = wp.media.view.AttachmentFilters.extend({
id: 'media-attachment-taxonomy-filter',
createFilters: function() {
var filters = {};
// Formats the 'terms' we've included via wp_localize_script()
// Save PDF from HTML Microservice
https://addaptive-microservices.herokuapp.com/api/html-to-pdf
const puppeteer = require('puppeteer');
class Webpage {
static async generatePDF(html) {
const browser = await puppeteer.launch({ headless: true }); // Puppeteer can only generate pdf in headless mode.
const page = await browser.newPage();