Skip to content

Instantly share code, notes, and snippets.

View mbootsman's full-sized avatar

Marcel Bootsman mbootsman

View GitHub Profile
@brunolemos
brunolemos / linkedin-unfollow-everyone.js
Last active February 3, 2024 05:47
Unfollow everyone on Linkedin
(() => {
let count = 0;
function getAllButtons() {
return document.querySelectorAll('button.is-following') || [];
}
async function unfollowAll() {
const buttons = getAllButtons();
@mgibbs189
mgibbs189 / test.php
Created March 27, 2017 13:11
Pass the current post ID to FacetWP
<?php
// See https://facetwp.com/how-to-use-hooks/
add_action( 'wp_head', function() {
?>
<script>
(function($) {
$(document).on('facetwp-refresh', function() {
FWP_HTTP.post_id = '<?php echo $post->ID; ?>';
});
@timothyjensen
timothyjensen / functions.php
Last active June 4, 2019 19:20
Add hooks before Genesis structural wraps.
<?php
// Prefixing is recommended if you are not using a namespace.
// namespace TimJensen\GenesisStarter\Setup;
/**
* Adds hooks immediately before and after Genesis structural wraps.
*
* @version 1.1.0
*
* @return void
@BjornW
BjornW / canned-linkedin-connection-request-response.txt
Last active February 3, 2024 05:54
Canned LinkedIn Connection Request reponse
Hi,
Thanks for your interest on connecting via LinkedIn.
Sadly your LinkedIn Connection Request contains just the plain default LinkedIn Connection request text without any context, personal touch or proper introduction. Therefore I assume this LinkedIn Connection Request was written by an automated algorithm and thus has been declined.
Bye!
PS: For any humans reading this, please communicate in a human-friendly way and I will respond accordingly.
@eteubert
eteubert / wordpress-passwort-reset-unmultisite.php
Last active April 15, 2024 20:45
Multisite: Passwort Reset on Local Blog
<?php
/**
* Plugin Name: Multisite: Passwort Reset on Local Blog
* Plugin URI: https://gist.github.com/eteubert/293e07a49f56f300ddbb
* Description: By default, WordPress Multisite uses the main blog for passwort resets. This plugin enables users to stay in their blog during the whole reset process.
* Version: 1.0.0
* Author: Eric Teubert
* Author URI: http://ericteubert.de
* License: MIT
*/
@nielsvr
nielsvr / posts.php
Created October 14, 2014 18:35
Get posts starting with a letter
<?php
add_filter( 'posts_where', 'start_with_letter', 10, 2 );
function start_with_letter( $where, &$wp_query )
{
global $wpdb;
if ( $start_with_letter = $wp_query->get( 'start_with_letter' ) ) {
$where .= ' AND ' . $wpdb->posts . '.post_title LIKE \'' . esc_sql( like_escape( $start_with_letter ) ) . '%\'';
}
@spivurno
spivurno / gw-gravity-forms-unrequire-required-fields-usage.php
Last active June 13, 2022 20:04
Gravity Wiz // Gravity Forms Unrequire Required Fields for Speedy Testing
<?php
# Basic Usage
# requires that the user be logged in as an administrator and that a 'gwunrequire' parameter be added to the query string
# http://youurl.com/your-form-page/?gwunrequire=1
new GWUnrequire();
# Enable for All Users (Including Visitors)
# still requires the 'gwunrequire' parameter be added to the query string
new GWUnrequire( array(
@mannieschumpert
mannieschumpert / gist:8334811
Last active August 20, 2023 14:58
Filter the submit button in Gravity Forms to change the <input type="submit> element to a <button> element. There's an example in the Gravity Forms documentation, but it lacks the proper code to show your custom button text, AND removes important attributes like the onclick that prevents multiple clicks. I was trying to solve that.
<?php
// filter the Gravity Forms button type
add_filter("gform_submit_button", "form_submit_button", 10, 2);
function form_submit_button($button, $form){
// The following line is from the Gravity Forms documentation - it doesn't include your custom button text
// return "<button class='button' id='gform_submit_button_{$form["id"]}'>'Submit'</button>";
// This includes your custom button text:
return "<button class='button' id='gform_submit_button_{$form["id"]}'>{$form['button']['text']}</button>";
}
// Oops this strips important stuff
@murdaugh
murdaugh / copy post to blog function
Created October 3, 2013 20:11
Copies a post (as well as its associated meta data) from one wordpress blog to another on the same network.
<?php
function copy_post_to_blog($post_id, $target_blog_id) {
$post = get_post($post_id, ARRAY_A); // get the original post
$meta = get_post_meta($post_id);
$post['ID'] = ''; // empty id field, to tell wordpress that this will be a new post
switch_to_blog($target_blog_id); // switch to target blog
$inserted_post_id = wp_insert_post($post); // insert the post
foreach($meta as $key=>$value) {
update_post_meta($inserted_post_id,$key,$value[0]);
}
@grtaylor2
grtaylor2 / Change Read More Text Genesis WordPress
Last active August 11, 2021 19:53
Change the [Read More] Text in Genesis WordPress Child Theme
/** Customize Read More Text */
add_filter( 'excerpt_more', 'child_read_more_link' );
add_filter( 'get_the_content_more_link', 'child_read_more_link' );
add_filter( 'the_content_more_link', 'child_read_more_link' );
function child_read_more_link() {
return '<a href="' . get_permalink() . '" rel="nofollow">CUSTOMIZE YOUR TEXT HERE</a>';
}