Skip to content

Instantly share code, notes, and snippets.

View annalinneajohansson's full-sized avatar
🐱

Anna annalinneajohansson

🐱
  • Frontwalker Group AB
  • Sweden
  • 06:38 (UTC +02:00)
View GitHub Profile
@annalinneajohansson
annalinneajohansson / WP_Widget.php
Created October 29, 2015 15:20
Base for WP_Widget
<?php
class My_Widget extends WP_Widget {
public function __construct() {
$widget_ops = array(
'classname' => 'my-widget',
'description' => __( 'My Widget description', 'textdomain' ),
);
$this->WP_Widget( 'My_Widget', __( 'My Widget title', 'textdomain' ), $widget_ops );
}
@annalinneajohansson
annalinneajohansson / change_acf_color_picker.php
Created October 21, 2015 12:00
Adds client custom colors to WYSIWYG editor and ACF color picker. #wordpress
<?php
function change_acf_color_picker() {
$client_colors = array(
"#DD3333",
"#81D742",
"#1E73BE",
"#8224E3",
"#DD9933",
"#EEEE22"
@annalinneajohansson
annalinneajohansson / wp_dashboard_setup.php
Last active September 25, 2015 16:21
Register wp dashboard widgets created via ACF Flexible Fields
<?php
function custom_dashboard_widgets() {
if ( function_exists( 'get_field' ) ) {
if ( get_field( 'custom-dashboard-widgets', 'options' ) ) {
$i = 0;
while( has_sub_field( 'custom-dashboard-widgets', 'options' ) ) :
# Shadow
shadow = true;
no-dnd-shadow = true;
no-dock-shadow = true;
clear-shadow = true;
shadow-radius = 2;
shadow-offset-x = -1;
shadow-offset-y = 0;
shadow-opacity = 0.5;
# shadow-red = 0.0;
'.platform-darwin atom-text-editor':
'alt-a': 'aligner:align'
'.platform-win32 atom-text-editor, .platform-linux atom-text-editor':
'alt-a': 'aligner:align'
'.platform-win32 atom-text-editor, .platform-linux atom-text-editor':
'ctrl-7': 'editor:toggle-line-comments'
'ctrl-shift-g': 'gist:create-public'
$exempeldata = Array
(
[company] =>
[title] =>
[name] => Anna
[surname] => Johansson
[address] => Array
(
[street] =>
[postal] =>
<?php
function hip_auto_login() {
/* emails with + will not work "properly", then wont be logged in with this filter */
if( isset( $_GET['u'] ) && isset( $_GET['plux'] ) && isset( $_GET['post_id'] ) ) {
$email = wp_kses( $_GET['u'],array() );
$checksum = wp_kses( $_GET['plux'],array() );
$post_id = wp_kses( $_GET['post_id'],array() );
if (!is_user_logged_in() && !empty($checksum) && !empty($email)) {
echo fs.inotify.max_user_watches=100000 | sudo tee -a /etc/sysctl.conf; sudo sysctl -p
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 94558F59
sudo sh -c 'echo "deb http://repository.spotify.com stable non-free" >> /etc/apt/sources.list.d/spotify.list'
@annalinneajohansson
annalinneajohansson / rc.xml
Created May 2, 2015 13:37
Vertical/horizontal window tiling in Openbox
<!-- Vertical tiling -->
<keybind key="W-Right">
<action name="UnmaximizeFull"/>
<action name="MoveResizeTo">
<width>50%</width>
</action>
<action name="MaximizeVert"/>
<action name="MoveResizeTo">
<x>50%</x>
<y>0</y>