Skip to content

Instantly share code, notes, and snippets.

Avatar

Anthony Brown anthonysbrown

  • Worcester, MA USA
View GitHub Profile
@anthonysbrown
anthonysbrown / wp-sitemap-page.php
Created Jul 21, 2022
Fix to support hierarchy post types for WP Sitemap page
View wp-sitemap-page.php
<?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
Add email to dropdowns on smarty document manager
View functions.php
<?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 Jan 21, 2022
Change the user dropdown name from SP client document manager
View functions.php
<?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 Jan 17, 2022
Include CDM scripts on any page
View functions.php
<?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 Dec 3, 2021
Do something after file upload
View functions.php
<?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){
View functions.php
<?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 Feb 1, 2021
overiding funeralpress css
View functions.php
<?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' );
View 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>
@anthonysbrown
anthonysbrown / functions.php
Last active Jan 3, 2020
Add a disclaimer on product pages by category
View functions.php
<?php
#Read article here https://worcesterwideweb.com/woocommerce-add-single-product-notice-on-a-per-category-basis-with-hierarchy/
add_filter( 'the_content', 'customizing_woocommerce_description' );
function customizing_woocommerce_description( $content ) {
global $post;
// Only for single product pages (woocommerce)
if ( is_product() ) {
# get the terms for this post
$terms = get_the_terms( $post->ID, 'product_cat' );