Skip to content

Instantly share code, notes, and snippets.

/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
@mzdebo
mzdebo / coronavirus_map_from_api.xml
Created April 6, 2020 15:15 — forked from carmoreira/coronavirus_map_from_api.xml
Export World Map with live info about covid-19 for Interactive Geo Maps WordPress plugin
<?xml version="1.0" encoding="UTF-8" ?>
<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your site. -->
<!-- It contains information about your site's posts, pages, comments, categories, and other content. -->
<!-- You may use this file to transfer that content from one site to another. -->
<!-- This file is not intended to serve as a complete backup of your site. -->
<!-- To import this information into a WordPress site follow these steps: -->
<!-- 1. Log in to that site as an administrator. -->
<!-- 2. Go to Tools: Import in the WordPress admin panel. -->
<!-- 3. Install the "WordPress" importer from the list. -->
<?php
/**
* Plugin Name: [Smush] - Bulk Delete Bak Images
* Plugin URI: https://premium.wpmudev.org/
* Description: Deletes all .bak images
* Author: Panos Lyrakis @ WPMUDEV
* Author URI: https://premium.wpmudev.org/
* License: GPLv2 or later
*/
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';
@mzdebo
mzdebo / gist:664cd6f2f7869486be191f6c87849535
Last active September 3, 2020 11:12
WooCommerce Products Sort and Display by a Custom meta field
/**
* Add Publish Year sorting option to shop page / WC Product Settings - WooCommerce
*/
function thbc_publishyear_woocommerce_shop_ordering( $sort_args ) {
$orderby_value = isset( $_GET['orderby'] ) ? woocommerce_clean( $_GET['orderby'] ) : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) );
if ( 'publishyear' == $orderby_value ) {
$sort_args['orderby'] = 'title';
$sort_args['order'] = 'asc'; //or desc
$sort_args['meta_key'] = 'publish-year';
@mzdebo
mzdebo / default-author.php
Created September 25, 2020 11:50 — forked from chrisguitarguy/default-author.php
Set a default author for posts on your WordPress site.
<?php
/*
Plugin Name: Default Author
Plugin URI: http://pmg.co
Description: Set a default author for all posts and pages
Version: 1.0
Text Domain: default-author
Author: Christopher Davis
Author URI: http://christopherdavis.me
License: GPL2
@mzdebo
mzdebo / register-post-type.php
Created October 2, 2020 14:40 — forked from justintadlock/register-post-type.php
Help file when registering post types.
<?php
# Register custom post types on the 'init' hook.
add_action( 'init', 'my_register_post_types' );
/**
* Registers post types needed by the plugin.
*
* @since 1.0.0
* @access public
@mzdebo
mzdebo / gist:92c620f9912fc0d29b69259e749f2ed4
Created October 17, 2020 20:50 — forked from shanebp/gist:b73343e9c9a6509d2bbc47de80c881c1
add last_activity timestamp to all BP members
/*
* Paste in your theme functions.php or in bp-custom.php.
* Load the site in a browser
* Remove from your theme functions.php or bp-custom.php.
*/
function buddypress_add_last_activity() {
$members = get_users( 'fields=ID' );
// $members = get_users( 'fields=ID&role=subscriber' );
@mzdebo
mzdebo / youzer_members_articles_tab
Created October 21, 2020 03:03
Youzer - Add shortcode to display current user posts in a custom tab
<?php
/**
* Author: Chanel via https://thehorsebc.world
*/
/**
* How to Use this
*
* Adapted for use with Youzer plugin via https://www.kainelabs.com
<?php
$args = array(
'label' => '', // Text in Label
'class' => '',
'style' => '',
'wrapper_class' => '',
'value' => '', // if empty, retrieved from post meta where id is the meta_key
'id' => '', // required
'name' => '', //name will set from id if empty