Archives: Snippets
eaglegame
const canvas = document.getElementById(‘game-canvas’); const ctx = canvas.getContext(‘2d’); class Character { constructor(name, x, y, width, height, color, level, hp, attack, xp) { this.name = name; this.x = x; this.y = y; this.width = width; this.height = height; this.color = color;…Continue reading
Google Ad Code generator
Add Multiple Checkboxes To Donation Form
/** * Add a collection of checkboxes to the donation form. * * This snippet only works in Charitable 1.5 or above. * */ function wpchar_charitable_register_new_checkboxes_field() { if ( ! class_exists(“Charitable_Donation_Field” ) ) { return; }; /** * Define a…Continue reading
Exclude All Posts of a Category from News Sitemap
add_filter( ‘aioseo_sitemap_exclude_posts’, ‘aioseo_sitemap_filter_excluded_posts’, 10, 2 ); function aioseo_sitemap_filter_excluded_posts( $ids, $type ) { if ( ‘news’ === $type ) { $category_id = 136; $posts_in_category = get_posts(array( ‘category’ => $category_id, ‘numberposts’ => -1, ‘fields’ => ‘ids’ )); $ids = array_merge($ids, $posts_in_category); }…Continue reading
SEP color
add_action(‘admin_head’, ‘sep_color’); function sep_color() { echo ‘ ‘; }Continue reading
Untitled Snippet
Adding Text/Currency To Progress Bar On Campaign Pages
add_filter( ‘charitable_campaign_builder_progress-bar_field_display’, ‘test_campaign_builder_field_display’, 10, 2 ); function test_campaign_builder_field_display( $html, $campaign_data ) { // search for “Goal:” and add a £ symbol to the goal amount. $html = str_replace( ‘Goal: ‘, ‘Goal: £’, $html ); return $html; }Continue reading
theme setup unocss assets
if ( ! function_exists( ‘theme_setup_unocss_assets’ ) ) : function theme_setup_unocss_assets() { wp_enqueue_style( ‘unocss-reset’, ‘https://unpkg.com/@unocss/reset/tailwind.css’, array(), null ); wp_enqueue_script( ‘unocss-preset-uno’, ‘https://unpkg.com/@unocss/runtime/uno.global.js’, array(), null, true ); wp_enqueue_script( ‘unocss-preset-icons’, ‘https://unpkg.com/@unocss/runtime/preset-icons.global.js’, array(), null, true ); wp_add_inline_script( ‘unocss-preset-icons’, ‘window.__unocss = { presets: [ () =>…Continue reading