Skip to content

Instantly share code, notes, and snippets.

import { InspectorControls } from '@wordpress/block-editor';
import { PanelBody } from '@wordpress/components';
import { addFilter } from '@wordpress/hooks';
import {RSVPEventOrder} from './event-order';
import RSVPControls from './rsvpslot';
import {RSVPTaxonomyControls} from './taxonomy-controls';
import RSVPControlsInheritedQuery from './rsvpslot-inherited-query';
import { __ } from '@wordpress/i18n';
const RSVP_VARIATION_NAME = 'rsvpmaker/rsvpmaker-loop';
/**
* From a block scaffolded using the Create Block utility
* Registers a new block provided a unique name and an object defining its behavior.
*
* @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/
*/
import { registerBlockType, createBlock, createBlocksFromInnerBlocksTemplate } from '@wordpress/blocks';
/**
* Lets webpack process CSS, SASS or SCSS files referenced in JavaScript files.
@davidfcarr
davidfcarr / dashboard-similarweb.php
Created July 18, 2023 14:14
WordPress Plugin for Similarweb Data Lookups
<?php
/*
Plugin Name: Dashboard Screen for Similarweb
*/
// see https://developer.wordpress.org/reference/
add_action('admin_menu','menu_for_similarweb');
function menu_for_similarweb() {
//anyone who can create blog posts can access this screen
//adds intval sanitization
if(!empty($_POST['resend']))
{
echo '<div class="notice"><p>Resending email requesting confirmation</p></div>';
$mail['from'] = get_option('admin_email');
$mail['fromname'] = get_option('blogname');
$mail['subject'] = 'Please confirm your subscription to the email list for '.$mail['fromname'];
foreach($_POST['resend'] as $id) {
$sql = "select email from $table where id = ".intval($id);
$mail['to'] = $wpdb->get_var($sql);
<?php
function rsvpBlockDataOutput($block, $post_id) {
if(empty($block))
return;
$attrs = ($block->attrs) ? json_encode($block->attrs) : '';
if(!empty($block->innerHTML) || (!empty($block->innerBlocks) && sizeof($block->innerBlocks)) ) {
$output = sprintf('<!-- wp:%s %s -->',$block->blockName,$attrs)."\n";
if(!empty($block->innerHTML))
$output .= $block->innerHTML."\n";
if(!empty($block->innerBlocks) && is_array($block->innerBlocks) && sizeof($block->innerBlocks)) {
<?php
function my_edit_site_menu($wp_admin_bar) {
$args = array(
'parent' => 'site-editor',
'id' => 'theme-header',
'title' => __('Header / Menu','twentytwentytwo-tm'),
'href' => admin_url('site-editor.php?postType=wp_template_part&postId=twentytwentytwo-tm%2F%2Fheader'),
'meta' => array( 'class' => 'twentytwentytwo-tm')
);
<?php
/*
* Adds variation on a block theme's single template for custom post type
* called on plugin activation or after_theme_switch action
*/
register_activation_hook( __FILE__, 'rsvpmaker_single_block_template' );
add_action('after_switch_theme','rsvpmaker_single_block_template');
function rsvpmaker_single_block_template() {
<!-- wp:wp4toastmasters/agendaedit {"editable":"Welcome and Introductions","uid":"editable16181528933590.29714489144034184","time_allowed":"5","inline":true} /-->
<!-- wp:wp4toastmasters/role {"role":"Toastmaster of the Day","agenda_note":"Introduces supporting roles. Leads the meeting.","time_allowed":"4","padding_time":"5"} /-->
<!-- wp:wp4toastmasters/role {"role":"Ah Counter"} /-->
<!-- wp:wp4toastmasters/role {"role":"Timer"} /-->
<!-- wp:wp4toastmasters/role {"role":"Vote Counter"} /-->
<?php
/*
Plugin Name: Multisite Hacks for MailPoet
Version: 1.1
Description: Example but DOES NOT SEEM TO WORK WITH THE LATEST MAILPOET VERSION. My recommended alternative to MailPoet https://rsvpmaker.com/blog/2022/08/27/rsvpmaker-postmark-free-email-marketing/
*/
function mailpoet_site_subscribers () {
if(!strpos($_SERVER['REQUEST_URI'],'mailpoet'))
return;
<?php
add_filter('mailpoet_newsletter_shortcode', 'mailpoet_rsvpmaker_shortcode', 10, 5);
function mailpoet_rsvpmaker_shortcode($shortcode, $newsletter, $subscriber, $queue, $newsletter_body) {
// always return the shortcode if it doesn't match your own!
if (!strpos($shortcode,'rsvpmaker') && !strpos($shortcode,'event_listing') ) return $shortcode;
global $email_context;
$email_context = true;
$shortcode = str_replace('custom:','',$shortcode);