Skip to content

Instantly share code, notes, and snippets.

View remcotolsma's full-sized avatar
🏢
Working @pronamic

Remco Tolsma remcotolsma

🏢
Working @pronamic
View GitHub Profile
@remcotolsma
remcotolsma / index.php
Created July 1, 2014 13:21
Covert legacy Orbis activities to WordPress taxonomy terms.
<?php
define( 'WP_USE_THEMES', false );
require '../wp-load.php';
global $wpdb;
$query = "SELECT * FROM $wpdb->orbis_activities;";
@remcotolsma
remcotolsma / Security.php
Created July 3, 2014 12:57
XML Security test SimpleXMLElement.
<?php
/**
* Title: XML Security
* Description:
* Copyright: Copyright (c) 2005 - 2014
* Company: Pronamic
* @author Remco Tolsma
* @version 1.0.0
*/
@remcotolsma
remcotolsma / wp-create-super-user.php
Last active June 7, 2017 05:30
WordPress create an multisite/network super user
<?php
// ADD NEW ADMIN USER TO WORDPRESS
// ----------------------------------
// Put this file in your Wordpress root directory and run it from your browser.
// Delete it when you're done.
require_once 'wp-load.php';
require_once 'wp-includes/registration.php';
$user_id = 5;
@remcotolsma
remcotolsma / functions.php
Created July 30, 2014 12:27
WordPress nav menu custom current URL ancestor
<?php
/**
* @see https://github.com/WordPress/WordPress/blob/3.9.1/wp-includes/nav-menu-template.php#L351-L358
*/
function prefix_wp_nav_menu_objects( $sorted_menu_items, $args ) {
// @see http://wordpress.stackexchange.com/a/126534
$current_url = home_url( add_query_arg( null, null ) );
foreach ( $sorted_menu_items as $menu_item ) {
@remcotolsma
remcotolsma / functions.php
Created August 6, 2014 14:57
WordPress menu walker classes for custom post types and archives.
<?php
/**
* Walker
*
* @see http://codex.wordpress.org/Class_Reference/Walker
* @see https://github.com/WordPress/WordPress/blob/3.9.1/wp-includes/nav-menu-template.php#L351-L358
*/
function prefix_nav_menu_objects( $sorted_menu_items ) {
$walker = new Pronamic_WP_Walker_Nav_Menu_Classes();
@remcotolsma
remcotolsma / fix-accented-filenames.php
Created September 4, 2014 11:15
WordPress fix accented filenames
<?php
// @see http://m.cg/post/75387759734/fix-accented-filenames-on-linux-with-convmv
// @see http://www.i18nqa.com/debug/utf8-debug.html
/**
* Súd-Sûdan.jpg
* Súd-Sûdan.jpg
* Súd-Sûdan.jpg
*/
@remcotolsma
remcotolsma / wp-pay-test.php
Created November 20, 2014 09:13
WordPress HTTP API test for WordPress Pay (Qantani and Mollie)
<?php
define( 'WP_USE_THEMES', false );
require '../../../wp-blog-header.php';
// HTTP
$http = _wp_http_get_object();
echo '<h2>_wp_http_get_object()</h2>';
@remcotolsma
remcotolsma / keybase.md
Created January 15, 2015 12:12
keybase.md

Keybase proof

I hereby claim:

  • I am remcotolsma on github.
  • I am remcotolsma (https://keybase.io/remcotolsma) on keybase.
  • I have a public key whose fingerprint is 472B 2440 3825 05A9 D6CC 60B3 4A32 5A0C 106D 73C3

To claim this, I am signing this object:

@remcotolsma
remcotolsma / index.php
Last active August 23, 2021 11:38
WordPress query loop in multiple Bootstrap columns and rows
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>FITsociety</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
@remcotolsma
remcotolsma / select-edd-license-users.sql
Last active August 29, 2015 14:17
Select Easy Digital Downloads license users and post authors.
SELECT
post.ID,
post.post_author,
post.post_title,
post.post_date,
post.post_type,
meta.meta_value AS edd_sl_user_id
FROM
wp_2_posts AS post
LEFT JOIN