Skip to content

Instantly share code, notes, and snippets.


Paul Barthmaier pbrocks

View GitHub Profile
pbrocks /
Created Aug 30, 2021 — forked from h2floh/
Bash script showing how to leverage az login to call Azure DevOps REST endpoints
## Demo script to show how to leverage Azure DevOps CLI Extension to call DevOps REST API directly
## without the need for PAT token
# configuration
# Reverse Engineered this part by looking into Azure DevOps CLI Extension
pbrocks / global-search-and-replace-query.sql
Created Aug 23, 2021 — forked from joedooley/global-search-and-replace-query.sql
SQL query that Find's all old URL's and Replaces with new URL values. This can be ran from phpmyadmin, etc...
View global-search-and-replace-query.sql
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl');
pbrocks / edit-form-advanced.php
Created Jul 17, 2021 — forked from tanamako/edit-form-advanced.php
View edit-form-advanced.php
* Post advanced form for inclusion in the administration panels.
* @package WordPress
* @subpackage Administration
// don't load directly
if ( !defined('ABSPATH') )
pbrocks / sublime-clean
Created May 17, 2020 — forked from gerardroche/sublime-clean
Clean Sublime Text caches and optionally clean out any sessions
View sublime-clean
# 301
pbrocks / acf_modifications.php
Created Nov 15, 2018 — forked from courtneymyers/acf_modifications.php
Reduces initial height of Advanced Custom Fields WYSIWYG fields to 100px, and enables autoresizing of WYSIWYG field, as text is entered. Best practice would be to include this function in a site-specific plugin.
View acf_modifications.php
* -----------------------------------------------------------------------------
* Advanced Custom Fields Modifications
* -----------------------------------------------------------------------------
function PREFIX_apply_acf_modifications() {
pbrocks /
Created Nov 15, 2018 — forked from psorensen/
Wordpress/TinyMCE - Add elements to formats dropdown

Adding Elements to the TinyMCE Format Dropdown

On a recent migration project, one of the requirements was to add a few blockquote styles to the TinyMCE dropdown list to match the editorial process of the old CMS. Wordpress provides a filter to add a secondary or tetriary dropdown, but if you only have a couple additional elements, it seems like bad UX to seperate it from the original dropdown.

Going off a tip from Chancey Mathews, I realized that Wordpress does not send a argument for block_formats when initializing TinyMCE, thus relying on the defaults. By adding this argument to the tiny_mce_before_init filter, we can add in our extra elements*:

* Note: since we're overriding the defaults, we need to include the original elements (p, h1-h6..etc)

function mce_formats( $init ) {
pbrocks / multiline_field.js
Created Nov 15, 2018 — forked from hunk/multiline_field.js
View multiline_field.js
if('undefined' != typeof tinyMCEPreInit){
// this is for relative_urls when the main editor is on text mode
if ( typeof tinymce !== 'undefined' ) {
for ( id in tinyMCEPreInit.mceInit ) {
init = tinyMCEPreInit.mceInit[id];
init.selector = "";
tinymce.init( init );
pbrocks / editor.jsx
Created Nov 15, 2018
The modification of react-tinymce component for webpack
View editor.jsx
// Dependencies
import _ from 'lodash'
// React
import React from 'react'
import PropTypes from 'prop-types'
// TinyMCE
import tinymce from 'tinymce/tinymce'
import 'tinymce/themes/modern/theme'
pbrocks / php-block.js
Created Oct 28, 2018 — forked from pento/php-block.js
Converting a shortcode to a block: this method is fast to do, but a mediocre UX. You should only use this as a stopgap until you can implement a full block UI.
View php-block.js
// License: GPLv2+
var el = wp.element.createElement,
registerBlockType = wp.blocks.registerBlockType,
ServerSideRender = wp.components.ServerSideRender,
TextControl = wp.components.TextControl,
InspectorControls = wp.editor.InspectorControls;
* Here's where we register the block in JavaScript.
pbrocks / pmpro-eu-dkk-format.php
Last active Oct 9, 2018 — forked from travislima/pmpro_eu_dkk_format.php
Change EU Danish Krone currency format for Paid Memberships Pro.
View pmpro-eu-dkk-format.php
<?php // do not include in Customizations plugin if copying and pasting
* Plugin Name: Add a Currency to global
* This code gist illustrates a way to customize the format of how your currency displays.
* In this example, we will change the PMPro Danish Krone currency
* from DKK 1,495.00
* to DKK 1 495,00