Skip to content

Instantly share code, notes, and snippets.

View lunule's full-sized avatar

lunule lunule

  • Vigilante One
  • Brno
View GitHub Profile
@lunule
lunule / randomize_wp_query_post_order.php
Last active November 5, 2016 04:54 — forked from fikrirasyid/Randomizing WP_Query's Posts Order
WordPress | Randomize order of posts resulted from WP_Query().
<?php
/**
* Assuming you want 8 latest posts and excluding sticky posts
*/
$posts_args = array(
'ignore_sticky_posts' => true,
'posts_per_page' => 8
);
@lunule
lunule / ajax_in_wordpress.js
Last active April 4, 2023 15:25 — forked from jackreichert/inputtitle_submit.js
Example showing how to use AJAX in WordPress
(function ($) {
$(document).ready(function () {
$('#next').click(function () {
$.ajax({
type: 'POST',
url: PT_Ajax.ajaxurl,
data: {
// wp ajax action
action: 'ajax-inputtitleSubmit',
@lunule
lunule / WooCommerce Custom Fields for Simple and Variable Products
Last active November 15, 2019 06:36 — forked from maddisondesigns/functions.php
WooCommerce Custom Fields for Simple & Variable Products
/*
* Add our Custom Fields to simple products
*/
function mytheme_woo_add_custom_fields() {
global $woocommerce, $post;
echo '<div class="options_group">';
// Text Field
@lunule
lunule / add-wordpress-settings-page.php
Created January 14, 2020 09:11 — forked from DavidWells/add-wordpress-settings-page.php
WordPress :: Add Settings Page with All Fields
<?php
/*
Plugin Name: Homepage Settings for BigBang
Plugin URI: http://www.inboundnow.com/
Description: Adds additional functionality to the big bang theme.
Author: David Wells
Author URI: http://www.inboundnow.com
*/
// Specify Hooks/Filters
<?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
@lunule
lunule / membership_meta.php
Created September 6, 2022 19:47 — forked from saltnpixels/membership_meta.php
adding membership meta to rcp from ACF
<?php
/*--------------------------------------------------------------
# Saving Features to Membership Levels from an acf repeater field for RCP Pro
--------------------------------------------------------------*/
function some_feature_list( $level ) {
/**
* @var RCP_Levels $rcp_levels_db
*/
global $rcp_levels_db;
@lunule
lunule / shell-setup.ps1
Created May 11, 2023 22:07 — forked from mikepruett3/shell-setup.ps1
Packages to install via scoop, winget, choco, and other tools...
<#
.SYNOPSIS
Script to Initialize my custom powershell setup.
.DESCRIPTION
Script uses scoop
.NOTES
**NOTE** Will configure the Execution Policy for the "CurrentUser" to Unrestricted.
Author: Mike Pruett
Date: October 18th, 2018
@lunule
lunule / easings-pt1.scss
Created August 5, 2023 17:59 — forked from terkel/_easing.scss
Timing functions for CSS animations and transitions
// _easing.scss, CSS easing functions - gist.github.com/terkel/4377409
// Based on Caesar - matthewlein.com/ceaser
$linear: cubic-bezier( 0.250, 0.250, 0.750, 0.750 );
$ease: cubic-bezier( 0.250, 0.100, 0.250, 1.000 );
$ease-in: cubic-bezier( 0.420, 0.000, 1.000, 1.000 );
$ease-out: cubic-bezier( 0.000, 0.000, 0.580, 1.000 );
$ease-in-out: cubic-bezier( 0.420, 0.000, 0.580, 1.000 );
$ease-in-quad: cubic-bezier( 0.550, 0.085, 0.680, 0.530 );
@lunule
lunule / wp-buttons.css
Last active December 7, 2023 21:46 — forked from SeanTOSCD/wp-buttons.css
WordPress Admin Style Buttons
/*
wp admin style buttons:
To use for links styled as buttons, add a class attribute to the
<a> tag and add "button" as a value. This sets up the basic button
structure. Then you choose which button you want to use. Add a
value of "blue" for the blue button or "gray" for the gray button.
Ex. <a href="#" class="button blue">Blue Button</a>
*/
@lunule
lunule / php--mime-types.php
Last active July 24, 2024 05:50 — forked from plasticbrain/gist:3887245
PHP: mime types (array format)
<?php
$mime_types = array(
'.3dm' => 'x-world/x-3dmf',
'.3dmf' => 'x-world/x-3dmf',
'.a' => 'application/octet-stream',
'.aab' => 'application/x-authorware-bin',
'.aam' => 'application/x-authorware-map',
'.aas' => 'application/x-authorware-seg',
'.abc' => 'text/vnd.abc',
'.acgi' => 'text/html',