Skip to content

Instantly share code, notes, and snippets.

View apsolut's full-sized avatar
🎯
Focusing

Aleksandar Perisic apsolut

🎯
Focusing
View GitHub Profile
@johnmegahan
johnmegahan / functions.php
Created January 12, 2012 01:50
Extended Walker class for use with the Twitter Bootstrap toolkit Dropdown menus in Wordpress.
<?php
add_action( 'after_setup_theme', 'bootstrap_setup' );
if ( ! function_exists( 'bootstrap_setup' ) ):
function bootstrap_setup(){
add_action( 'init', 'register_menu' );
@bgallagh3r
bgallagh3r / wp.sh
Last active March 24, 2024 03:12
Wordpress: Bash Install Script -- Downloads latest WP version, updates wp-config with user supplied DB name, username and password, creates and CHMOD's uploads dir, copies all the files into the root dir you run the script from, then deletes itself!
#!/bin/bash -e
clear
echo "============================================"
echo "WordPress Install Script"
echo "============================================"
echo "Database Name: "
read -e dbname
echo "Database User: "
read -e dbuser
echo "Database Password: "
@brianblakely
brianblakely / rem-calibrate.css
Created July 13, 2012 18:55
Simulate vw with rems
/* Android stock browser won't let you set font-size smaller than 8px unless you apply this. */
:root {
-webkit-text-size-adjust: none;
-moz-text-size-adjust: none;
-ms-text-size-adjust: none;
-o-text-size-adjust: none;
text-size-adjust: none;
}
@jameskoster
jameskoster / functions.php
Created March 11, 2013 11:24
WooCommerce - Add new product tab
add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab' );
function woo_new_product_tab( $tabs ) {
// Adds the new tab
$tabs['test_tab'] = array(
'title' => __( 'New Product Tab', 'woocommerce' ),
'priority' => 50,
'callback' => 'woo_new_product_tab_content'
);
@leonderijke
leonderijke / svgfixer.js
Last active June 17, 2024 07:57
Fixes references to inline SVG elements when the <base> tag is in use.
/**
* SVG Fixer
*
* Fixes references to inline SVG elements when the <base> tag is in use.
* Firefox won't display SVG icons referenced with
* `<svg><use xlink:href="#id-of-icon-def"></use></svg>` when the <base> tag is on the page.
*
* More info:
* - http://stackoverflow.com/a/18265336/796152
* - http://www.w3.org/TR/SVG/linking.html
@ahmadawais
ahmadawais / .zshrc
Created April 24, 2016 19:52
WP CLI Plugin & Theme Install/Activate Aliases for ZSH/BASH
# WP Plugin: Install & Acticate
# Usage: wpp plugin-slug
alias wpp="wp plugin install $* --activate"
# WP Theme: Install
# Usage: wpt plugin-slug
alias wpt="wp theme install $* --activate"
# WP Theme: Activate
# Usage: wpta plugin-slug
@ScreamingDev
ScreamingDev / deployer-wordpress-recipe.php
Last active November 16, 2016 07:53
Deployer: WordPress recipe using wp-cli
<?php
// some might like this as 'deploy:clean', most have 'cleanup'
$clean_hook = 'cleanup';
// assume wp cli is in the repo via composer
// change this to the path of your wp executable
set( 'wpcli_command', 'vendor/bin/wp' );
function deployer_wp_cli( $command ) {
@igorbenic
igorbenic / change_link.php
Last active February 21, 2024 21:31
Custom WordPress Rewrite Rule to Combine Taxonomy and Post Type | www.ibenic.com/custom-wordpress-rewrite-rule-combine-taxonomy-post-type
@kloon
kloon / fake-emails.php
Last active September 12, 2018 14:07
WooCommerce prohibit account creation with fake emails, ie sharklashers.com
<?php
/**
* Do not allow account creation with temp email addresses
* @param Object $validation_errors
* @param string $username
* @param string $email
* @return WP_Error
*/
function do_not_allow_temp_email_addresses( $validation_errors, $username, $email ) {
$prohibitied_domains = array(
@AaronRutley
AaronRutley / ar_save_testimonials_to_content.php
Last active December 30, 2020 14:48
Save ACF Testimonials to post content
<?php // Save ACF Testimonials to post content
function ar_save_testimonials_to_content( $post_id ) {
// Only run this code if we're on a particilar post / page
if( $post_id === 1234 ) {
// Start an output buffer
ob_start();
// Loop over our testimonials