Skip to content

Instantly share code, notes, and snippets.

View davemoz's full-sized avatar

Dave Mozdzanowski davemoz

View GitHub Profile
<?php
if(!function_exists('wc_get_products')) {
return;
}
$paged = (get_query_var('paged')) ? absint(get_query_var('paged')) : 1;
$ordering = WC()->query->get_catalog_ordering_args();
$ordering['orderby'] = array_shift(explode(' ', $ordering['orderby']));
$ordering['orderby'] = stristr($ordering['orderby'], 'price') ? 'meta_value_num' : $ordering['orderby'];
@carlodaniele
carlodaniele / custom_menu_admin.php
Last active May 26, 2022 20:32
A basic plugin showing how to add menu metaboxes to admin menu page
<?php
/**
* @package Custom_menu_admin
* @version 1.0
*/
/*
Plugin Name: Custom menu admin
Plugin URI: http://wordpress.org/extend/plugins/#
Description: This is an example plugin
Author: Carlo Daniele
@grenade
grenade / 01-generate-ed25519-ssh-key.sh
Last active April 14, 2024 14:27
generate ed25519 ssh and gpg/pgp keys and set file permissions for ssh keys and config
#!/bin/bash
# generate new personal ed25519 ssh key
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "rob thijssen <rthijssen@gmail.com>"
# generate new host cert authority (host_ca) ed25519 ssh key
# used for signing host keys and creating host certs
ssh-keygen -t ed25519 -f manta_host_ca -C manta.network
eval "$(ssh-agent -s)"
@jrfnl
jrfnl / wp-config-debug.php
Last active April 5, 2024 18:16
Code to add to wp-config.php to enhance information available for debugging.
<?php
/**
* == About this Gist ==
*
* Code to add to wp-config.php to enhance information available for debugging.
*
* You would typically add this code below the database, language and salt settings
*
* Oh.. and *do* make sure you change the path to the log file to a proper file path on your server (make sure it exists).
*
@jexchan
jexchan / multiple_ssh_setting.md
Created April 10, 2012 15:00
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@thenbrent
thenbrent / gist:1625033
Created January 17, 2012 05:43
WordPress Custom Post Type Message
/**
* Replaces "Post" in the update messages for custom post types on the "Edit" post screen.
*
* For example, for a "Product" custom post type, "Post updated. View Post." becomes "Product updated. View Product".
*
* @param array $messages The default WordPress messages.
*/
function pico_custom_update_messages( $messages ) {
global $post, $post_ID;