Skip to content

Instantly share code, notes, and snippets.

View ideag's full-sized avatar

Arūnas Liuiza ideag

View GitHub Profile
<?php
/**
* Plugin Name: Anarchy
* Description: Enable anarchy in WordPress - allow every user to do EVERYTHING in WP Admin.
* Version: 1.0.0
* Author: Arūnas Liuiza
* Author URI: https://arunas.co
* License: GPL2
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
*
<?php
add_filter( 'menu_title', 'arunasco_icons' );
function arunasco_title( $title ) {
$title = do_shortcode( $title );
return $title;
}
// [icon name="fa-coffee"]
add_shortcode( 'icon', 'arunasco_icons_shortcode' );
function arunasco_icons_shortcode( $attr=array(), $content = '' ) {
<?php
function themename_customize_register($wp_customize){
$wp_customize->add_section('themename_color_scheme', array(
'title' => __('Color Scheme', 'themename'),
'priority' => 120,
));
// =============================
<?php
$args = array(
'post_type' => 'post',
'tax_query' => array(),
);
if ( $filtercategory ) {
$args['tax_query'][] = array(
'taxonomy' => 'category',
'terms' => $filtercategory,
'field' => 'term_id',
<?php
/*
Plugin Name: Apex Add Latin-extended
Plugin URI: http://arunas.co
Description: Add Latin-ext to Google fonts in Apex theme
Author: Arūnas Liuiza
Version: 0.1.0
Author URI: http://arunas.co
*/
<?php
add_filter( 'harvestteachings_metabox_fields', 'arunas_teaching_author' );
function arunas_teaching_author($metabox) {
$metabox['fields']['ht_speaker']['default'] = 'Your Speaker name';
return $metabox;
}
<?php
define('TOKEN_SECRET', 'plugin_token' );
define('PLUGIN_SLUG', 'plugin_slug' );
EdwinDeployer::parse();
class EdwinDeployer {
public static $json = false;
public static $repo = '';
<?php
function cart_notice() {
if ( arunas_only_virtual_products() ) {
return true;
}
$free_shipping_settings = get_option( 'woocommerce_free_shipping_settings' );
$maximum = $free_shipping_settings['min_amount'];
$current = WC()->cart->subtotal;
$formatteddifference = wc_price( $maximum - $current );
function get_thumbnail_url( $size='thumbnail' ) {
$image_id = get_post_thumbnail_id( get_the_ID() );
$thumb = wp_get_attachment_image_src( $image_id, 'thumbnail_size' );
$url = $thumb['0'];
return $url;
}
@ideag
ideag / limit_blogname.php
Last active October 8, 2015 07:27
A short function to limit WordPress blog title to 40 symbols.
<?php
add_filter( 'pre_update_option_blogname', 'arunas_limit_blogname', 10, 2 );
function arunas_limit_blogname( $value, $old_value ) {
// check for length (pr do any other kind of validation)
if ( 40 < strlen($value) ) {
// throw error via Settings API
add_settings_error(
'blogname', // option name
'blogname', // error id
__( 'Blog title is too long', 'plugin-slug' ),