Skip to content

Instantly share code, notes, and snippets.

@edalis
edalis / remove-url-field-comment-form.php
Last active August 16, 2018 14:23
WP Genesis: Remove URL Field Comment Form
add_filter( 'genesis_comment_form_args', 'url_filtered' );
add_filter( 'comment_form_default_fields', 'url_filtered' );
function url_filtered( $fields ) {
if ( isset( $fields['url'] ) )
unset( $fields['url'] );
if ( isset( $fields['fields']['url'] ) )
unset( $fields['fields']['url'] );
@edalis
edalis / cookie.js
Created May 10, 2018 08:55
JavaScript getCookie(), setCookie(), deleteCookie()
@edalis
edalis / time-converter.js
Created May 10, 2018 08:46
JavaScript Time Converter
function timeConverter(UNIX_timestamp) {
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
const monthsRu = ['Января', 'Февраля', 'Марта', 'Апреля', 'Мая', 'Июня', 'Июля', 'Августа', 'Сентября', 'Октября', 'Ноября', 'Декабря'];
let date = new Date(UNIX_timestamp);
let year = date.getFullYear();
let month = monthsRu[date.getMonth()];
let day = date.getDate();
@edalis
edalis / App\Exceptions\Handler.php
Created February 11, 2017 08:28 — forked from jacurtis/App\Exceptions\Handler.php
How to get filp/whoops to work in Laravel 5.2 or 5.3 - Add this code to your `App\Exceptions\Handler.php` file.
/**
* Create a Symfony response for the given exception.
*
* @param \Exception $e
* @return mixed
*/
protected function convertExceptionToResponse(Exception $e)
{
if (config('app.debug')) {
$whoops = new \Whoops\Run;
@edalis
edalis / header.php
Created November 23, 2016 08:49
PHP: Charset
<?php
header('Content-Type: text/html; charset=utf-8');
@edalis
edalis / .htaccess
Created November 23, 2016 08:39
Charset
AddDefaultCharset utf-8
# PHP version >= 5.6
php_flag default_charset utf-8
@edalis
edalis / .htaccess
Last active November 12, 2016 07:59
Laravel: Redirect to ./public
RewriteEngine On
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
@edalis
edalis / .htaccess
Last active November 5, 2016 08:33
Redirect http:// to https://, http://www to https://
## https://www.reg.ru/support/hosting-i-servery/sajty-i-domeny/kak-dobavit-redirekt/redirekt-s-http-na-https
## вариант 1
RewriteEngine On
RewriteCond %{HTTPS} =on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [QSA,L]
## вариант 2
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
@edalis
edalis / customizing-comment-form.php
Last active October 17, 2016 07:41
WP Genesis: Customizing HTML5 Comment Form
// http://tinyurl.com/p4fddly
//***Customize The Comment Form**/
add_filter( 'comment_form_defaults', 'bourncreative_custom_comment_form' );
function bourncreative_custom_comment_form($fields) {
$fields['comment_notes_before'] = ''; //Removes Email Privacy Notice
$fields['title_reply'] = __( 'Share Your Comments & Feedback:', 'customtheme' ); //Changes The Form Headline
$fields['label_submit'] = __( 'Share My Comment', 'customtheme' ); //Changes The Submit Button Text
$fields['comment_notes_after'] = ''; //Removes Form Allowed Tags Box
return $fields;
}
@edalis
edalis / loading-parent-styles-for-child-themes.php
Last active October 17, 2016 07:39
WP: Loading Parent Styles for Child Themes
// http://justintadlock.com/archives/2014/11/03/loading-parent-styles-for-child-themes
add_action( 'wp_enqueue_scripts', 'my_enqueue_styles' );
function my_enqueue_styles() {
/* If using a child theme, auto-load the parent theme style. */
if ( is_child_theme() ) {
wp_enqueue_style( 'parent-style', trailingslashit( get_template_directory_uri() ) . 'style.css' );
}