Skip to content

Instantly share code, notes, and snippets.

@askaria
askaria / Description-and-Usage.md
Created January 14, 2023 18:05 — forked from dragermrb/Description-and-Usage.md
HTML5 Resize image before upload without ajax

HTML5 Resize image before upload without ajax

Allows to resize a file input image before upload to the server. The resized image will be attached to original file input. Then you can submit your form without ajax or handle it as you need.

Usage as jQuery Plugin

<form>
    <label>Select image</label>
@askaria
askaria / WP Customizer - Text
Created September 12, 2020 16:36 — forked from ajskelton/WP Customizer - Text
Add a Text field to the WordPress Customizer.
$wp_customize->add_setting( 'themeslug_text_setting_id', array(
'capability' => 'edit_theme_options',
'default' => 'Lorem Ipsum',
'sanitize_callback' => 'sanitize_text_field',
) );
$wp_customize->add_control( 'themeslug_text_setting_id', array(
'type' => 'text',
'section' => 'custom_section', // Add a default or your own section
'label' => __( 'Custom Text' ),
@askaria
askaria / tps-widget-select-categories-to-link.php
Created July 10, 2016 08:25 — forked from tatianepires/tps-widget-select-categories-to-link.php
Code for WordPress that adds a widget to select categories to be linked.
<?php
/**
* Remove Post Title from Breadcrumb.
*
* Takes a substring of crumb, starting at 0, with a length of up to the last occurrence of the
* (start of the) separator string.
*/
function be_remove_title_from_single_crumb( $crumb, $args ) {
return substr( $crumb, 0, strrpos( $crumb, $args['sep'] ) );
<?php //* mind this opening php tag
/**
* Display Last Updated date if a post has been updated (Genesis Framework)
*/
add_filter( 'genesis_post_info', 'rv_post_info_filter' );
function rv_post_info_filter( $post_info ) {
global $post;
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="robots" content="noodp, noydir" />
<link rel="dns-prefetch" href="//cdnjs.cloudflare.com">
<link rel="canonical" href="http://mysite.com/" />
<link rel="stylesheet" href="http://mysite.com/style.css" type="text/css" />
<?php
/*
Plugin Name: Hidden Comment Form
Plugin URI: http://tarskitheme.com/help/hooks/example-plugins/
Description: Hide the comment form until the user clicks a link to reveal it.
Author: Benedict Eastaugh
Version: 1.1
Author URI: http://extralogical.net/
*/
<?php
//* Do NOT include the opening php tag
//* ALL EXAMPLES ON THIS PAGE USE THE NEW HTML5 METHOD
//* Remove page titles site wide (posts & pages) (requires HTML5 theme support)
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );