Skip to content

Instantly share code, notes, and snippets.

View BoweFrankema's full-sized avatar

Bowe Frankema BoweFrankema

View GitHub Profile
@BoweFrankema
BoweFrankema / widget-test.json
Created April 4, 2024 07:37
widget-test.json
{
"widget_title": "Custom Widget",
"widget_size": "full",
"widget_html": "<div class=\"items-center dol-empty-state max-w-screen-xl gap-8 px-4 py-2 mx-auto xl:gap-16 md:grid md:grid-cols-2 sm:py-16 lg:px-6\">\n <div class=\"mt-4 md:mt-0\">\n <h2 class=\"mb-4 text-xl font-extrabold tracking-tight text-gray-900 dark:text-white\">No vulnerabilities detected</h2>\n <p class=\"mb-6 font-light text-gray-500 md:text-lg dark:text-gray-400\">\n Your sites are clean. If we detect any vulnerability we will let you know immediately.\n </p>\n </div>\n</div>"
}
@BoweFrankema
BoweFrankema / test.json
Last active March 29, 2024 10:51
test.json
[{"role":"user","content":"Can you write something about our Stuart?"},{"role":"assistant","content":"Certainly! Here's a draft for the newsletter content focusing on the Site Backups feature.\n\n---\n\n**Headline:** \nSafeguard Your Digital Masterpieces: Introducing Dollie's Site Backups!\n\n**Introduction:** \nIn the digital realm, our websites are akin to towering cities, reflecting months, if not years, of craftsmanship. Just as historians protect ancient scrolls, at Dollie, we understand the significance of safeguarding your online legacy. Cast your mind back to the days of early web development; a single misstep could lead to digital disaster. No more. With Dollie's Site Backups, the assurance of a safety net is no longer a luxury\u2014it's your new reality.\n\n**Main Content:** \nNavigate through the new waves of web prowess with Dollie's cutting-edge Site Backups feature. Offering more than just a fallback, our latest update brings you the tranquility of knowing that your sites are replicated in a
@BoweFrankema
BoweFrankema / example.php
Last active November 2, 2018 16:38
ACF FB Redirect
<?php
//Redirect on special URL format. ie: https://examplesite.com/?profile=visit
function fb_acf_profile_redirect()
{
$profile = $_GET['profile'];
//Is the profile link being requested
if ( $profile == 'visit' ) {
wp_safe_redirect( get_field('profile_redirect', 'option') );
exit;
}
@BoweFrankema
BoweFrankema / random_login.php
Created June 1, 2017 12:55
Add random login string after login.
function jpr_generateRandomString($length = 10) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
return $randomString;
}
@BoweFrankema
BoweFrankema / author-role.php
Created March 31, 2017 22:27
Make user author
add_action('bp_core_activated_user', 'bp_custom_registration_role',10 , 3);
function bp_custom_registration_role($user_id, $key, $user) {
$userdata = array();
$userdata['ID'] = $user_id;
$userdata['role'] = 'author';
//only allow if user role is my_role
if (($userdata['role'] == "subscriber") or ($userdata['role'] == "contributor"))
wp_update_user($userdata);
}
@BoweFrankema
BoweFrankema / 260-2
Created December 18, 2015 11:07
Add Default Classes to Sidebar
<?php
/**
* Add the code below to your WeFoster Child Theme
*/
function wfc_add_main_class() {
echo 'my-custom-class ';
}
add_action( 'class_main','wfc_add_main_class' );
function wfc_add_sidebar_class() {
@BoweFrankema
BoweFrankema / doing-it-right.html
Created December 17, 2015 12:39
Actions Code Examples
<?php get_template_part('templates/loops/content', 'page'); ?>
<!-- My Custom Content -->
<p>This is some custom content after my page content is shown. I'm adding this by overwriting my template via a Child Theme!</p>
<!-- My Custom Content -->
<?php do_action('close_page_content'); ?>
@BoweFrankema
BoweFrankema / acf-customizer-patch.php
Created December 3, 2015 08:36 — forked from fabrizim/acf-customizer-patch.php
Plugin to allow for Advanced Custom Fields to be used in widgets within the Customizer
<?php
/*
Plugin Name: ACF Customizer Patch
Plugin URI: https://gist.github.com/fabrizim/9c0f36365f20705f7f73
Description: A class to allow acf widget fields to be stored with normal widget settings and allow for use in customizer.
Author: Mark Fabrizio
Version: 1.0
Author URI: http://owlwatch.com/
*/
class acf_customizer_patch
@BoweFrankema
BoweFrankema / load_anspress.php
Created November 6, 2015 17:58
Load AnsPress conditionally.
<?php
function wfc_load_anpress_when_needed() {
if ( is_anspress() ) {
ap_scripts_front();
}
}
add_action('wp_enqueue_scripts', 'wfc_load_anpress_when_needed', 1);
@BoweFrankema
BoweFrankema / starter-settings.php
Created October 13, 2015 19:03
starter-settings.php
<?php
function wefoster_import_starter_settings() {
$screen = get_current_screen();
if (strpos($screen->id, "acf-options-starter-kits") == true) {
// Check to see if the settings have already been imported.
$starterkit = get_field( "choose_a_starter_kit", 'option' );
$template = get_template();
$imported = get_option( $template . '_' . $starterkit . '_customizer_import', false );