Skip to content

Instantly share code, notes, and snippets.

View sbruner's full-sized avatar

Steve Bruner sbruner

View GitHub Profile
@sbruner
sbruner / oembed-comments.php
Created November 20, 2023 00:34
oEmbed in Comments
function sfire_embed_oembed_in_comments( $comment_text ) {
// Extract URLs from the comment text
$urls = wp_extract_urls( $comment_text );
// Process each URL
foreach ( $urls as $url ) {
// Check if the URL can be embedded
$embed_html = wp_oembed_get( $url );
// echo $embed_html;
@sbruner
sbruner / composer.json
Last active April 20, 2022 15:48
composer.json for WordPress development
{
"name": "mycompany/myproject",
"description": "Lint and format code for a WordPress website.",
"type": "project",
"license": "GPL-2.0-or-later",
"authors": [
{
"name": "SlipFire",
"email": "[email protected]"
}
*~
.gitignore
.DS_Store
.htaccess
.svn
.cvs
*.bak
*.swp
*.log
*.sql
@sbruner
sbruner / id_rsa.pub
Last active January 7, 2022 16:28
Steve's Public SSH Key
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDHikHKobHzz/Yq3x39ITS8G/TOX413Du4n/CrJiXtqTfpF1KCpca/zRWY5o6zeYwgm2ocfvY93L2uyr+MRjsFmfiRj1NLjf4l1stkdJk4tGRgYRvRSXmFrC27E3Vh84+JVKBxjxCgKDzeI9unNsygWQZcG7P4elEBVfINuUzFX6QfDXfNGkJg2duiQQg6C4f2Sy290yExbrj6HgKYmfufEXyWSU/p5eYr9oC8nXnkFl6v5R+VxbR8HSkv4J2eUS1NY5UdKQsyKDn1Vurui7gph3xZnwBkZKwUfLENOeTUoo6QivfipsPE4MZOWguTJkZVhm+s7nZHBQ+CHa2cExcs5Z/WcFbKMj79NlwU/zAM3ESzBsO0spbGMSaRFXS14XLacVPoDQwTz8xrHhVV7hc9HUxs2m3ry9Q/809yhUveudJffLpqNmuPG+UxqccG3blJ4LVk25NwQu61BZAmlL3FsvFiOnJoIQYvVnm0ea9WcQWHU9IPE5350+7RCU+MUvJ+MLjJmBl9O1qa9zlVhUfF2k6ECPK4kqv6P1Mc/JLFBqXch5aQ+P7Mza8Lgv+akPxE4cbWcINVusUJuXlAuxOBd2dN8bkKTwk3KYt/tl9aaNJm5Io9TtvWTNGTo6JfEyJdL7Q8eXg9OL5QUdTXEC1J/eSlKvEzNP40AeKnQw9eQUQ==

Keybase proof

I hereby claim:

  • I am sbruner on github.
  • I am sbruner (https://keybase.io/sbruner) on keybase.
  • I have a public key ASBCedcdTdKAurnyjaXpnmSJRzIKey_EyAlZgmFAQ352OAo

To claim this, I am signing this object:

function my_custom_init() {
remove_post_type_support( 'post', 'custom-fields' );
}
add_action( 'init', 'my_custom_init' );
@sbruner
sbruner / auto-insert-user.php
Last active April 26, 2022 20:29
Creates administrator and super administrator role (WP Multisite)
<?php
/**
* sfire_create_user
*
* Auto create a user
* Creates administrator and super administrator role (WP Multisite)
* Can be used when you have SFTP access but no user access
* 1. create a wp-content/mu-plugins folder
* 2. Upload this file
* 3. Visit your site and log in.
function sfire_avatax_http_request_args($args, $this) {
$body = $args['body'];
$body = json_decode($body);
if(!empty($body->PurchaseOrderNo)) {
if(!empty($body->DocCode)) {
$body->DocCode = $body->PurchaseOrderNo;
<?php
// Use the built-in sanitize function: file_name
piklist('field', array(
'type' => 'text'
,'label' => 'File Name'
,'field' => 'sanitize_file_name'
,'description' => 'Converts multiple words to a valid file name'
,'sanitize' => array(
array(
// sanitize parameter example. Must be in field function
,'sanitize' => array(
array(
'type' => 'html_class'
,'options' => array(
'fallback' => 'my-default-class'
)
,'callback' => 'my-custom-callback'
)