Skip to content

Instantly share code, notes, and snippets.

View anthonysbrown's full-sized avatar

Anthony Brown anthonysbrown

  • Worcester, MA USA
View GitHub Profile
@anthonysbrown
anthonysbrown / functions.php
Created January 21, 2023 19:24
Smarty pants plugins select2 dropdown userse
<?php
add_filter('spcdm/premium/select_user/query', function($users){
$users = get_users( array(
'meta_key' => 'first_name',
'orderby' => 'meta_value',
'order' => 'ASC'
) );
@anthonysbrown
anthonysbrown / wp-sitemap-page.php
Created July 21, 2022 00:50
Fix to support hierarchy post types for WP Sitemap page
<?php
/**
Plugin Name: WP Sitemap Page
Plugin URI: http://tonyarchambeau.com/
Description: Add a sitemap on any page/post using the simple shortcode [wp_sitemap_page]
Version: 1.99.2
Author: Tony Archambeau
Author URI: http://tonyarchambeau.com/
Text Domain: wp-sitemap-page
Domain Path: /languages
@anthonysbrown
anthonysbrown / functions.php
Created May 25, 2022 18:43
Add email to dropdowns on smarty document manager
<?php
add_filter('sp_cdm/admin/fileview/dropdown', function($dropdown){
$arrParts = explode("</select>", $dropdown);
foreach($arrParts as &$part){
if($selPos = strpos($part, "<select")){
$part = substr($part, 0, $selPos);
}
}
@anthonysbrown
anthonysbrown / functions.php
Created January 21, 2022 20:06
Change the user dropdown name from SP client document manager
<?php
add_filter('spcdm/premium/select_user/name', '_custom_cdm_dropdown_name', 10,2);
function _custom_cdm_dropdown_name($name,$user){
return $user->user_nicename;
}
@anthonysbrown
anthonysbrown / functions.php
Created January 17, 2022 20:52
Include CDM scripts on any page
<?php
#add the filter
add_filter('sp_is_used', function($used){
global $post;
#add your condition, in this instance we are checking to see if the page id 80
if($post->ID == 80){
$used = true;
}
@anthonysbrown
anthonysbrown / functions.php
Created December 3, 2021 14:31
Do something after file upload
<?php
/*
$target_path= full path of uploaded file (not yet inserted into db)
$uid = the ID of the user uploading the file
*/
add_action('sp_cdm_after_file_upload','my_file_insert',10,3);
function my_file_insert($target_path,$uid){
<?php
/*
$a = db insert array
$file_id = the ID of the file
$post = the form post object
*/
add_action('sp_cdm_after_file_insert','my_file_insert',10,3);
@anthonysbrown
anthonysbrown / functions.php
Created February 1, 2021 14:56
overiding funeralpress css
<?php
function funeralpress_custom_styles() {
wp_enqueue_style( 'wpfh-style-custom-styles', get_stylesheet_directory_uri().'funeralpress.css', array('wpfh-style','wpfh-cem-style') );
}
add_action( 'wp_enqueue_scripts', 'funeralpress_custom_styles' );
@anthonysbrown
anthonysbrown / divisoup.js
Created December 15, 2020 00:43
divisoup.js
<script>jQuery(document).ready(function($) {
$("img[title]").each(function() { $(this).removeAttr("title"); });
});</script>
<script type="text/javascript">
jQuery(document).ready( function($) {
$(".et_pb_contact_captcha_question").prepend("<span> Please prove your humanity &nbsp;&nbsp;</span>" );
});
</script>
<title><?php wp_title( '|', true, 'right' ); ?></title>