Skip to content

Instantly share code, notes, and snippets.

View ValeriiVasyliev's full-sized avatar
🏄
Focusing

Valerii Vasyliev ValeriiVasyliev

🏄
Focusing
View GitHub Profile
@ValeriiVasyliev
ValeriiVasyliev / settings.local.php
Created May 29, 2017 16:24 — forked from scor/settings.local.php
Drupal 8. Settings local - development mode
<?php
/**
* @file
* Local development override configuration feature.
*
* To activate this feature, copy and rename it such that its path plus
* filename is 'sites/yoursite.com/settings.local.php'. Then, go to the bottom
* of 'sites/yoursite.com/settings.php' and uncomment the commented lines that
* mention 'settings.local.php'.
@ValeriiVasyliev
ValeriiVasyliev / __INDEX.txt
Created June 29, 2017 09:42 — forked from facine/__INDEX.txt
Drupal 8 - Examples
# Taxonomy terms:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_taxonomy_term-php
# Menu links:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_menu_link-php
# File items:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_file-php
# Nodes:
<?
function MYMODULE_form_node_admin_content_alter(&$form, &$form_state, $form_id) {
$column_alias = 'my_cool_column';
$column_title = 'Header of my cool column';
// Load the nodes. This incurrs very little overhead as
// "$nodes = node_load_multiple($nids);" has already been run on these
// nids in node_admin_nodes(). The static cache will be used instead of
// another db query being invoked
$nodes = node_load_multiple(array_keys($form['admin']['nodes']['#options']));
@ValeriiVasyliev
ValeriiVasyliev / gist:5e5aec05aead21ecd37d7f7e6a72a294
Created August 7, 2017 06:46 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@ValeriiVasyliev
ValeriiVasyliev / prestashop-lib.php
Created August 27, 2018 15:47 — forked from matchaxnb/prestashop-lib.php
Library to manipulate Prestashop from scripts
<?php
/**
prestashop-lib — © 2015 Chloé Tigre Rouge <chloe@tigres-rouges.net>
This is licensed under the same terms as Prestashop.
PrestaShop library to create products, categories and all sorts of things
programmatically by passing arrays around
It needs a bootstrapped PrestaShop framework (you can get one by defining
_PS_ROOT_DIR_ and by a
require_once(_PS_ROOT_DIR_.'config/config.inc.php');
@ValeriiVasyliev
ValeriiVasyliev / Wordpress Rewrite Rules Example
Created January 18, 2019 15:29 — forked from benvisser/Wordpress Rewrite Rules Example
Sample Wordpress rewrite rule filters
///////////////////////////////////
// Rewrite Rules
///////////////////////////////////
//rewrite rules
add_filter('rewrite_rules_array','wp_insertMyRewriteRules');
add_filter('query_vars','wp_insertMyRewriteQueryVars');
add_filter('init','flushRules');
// Remember to flush_rules() when adding rules
@ValeriiVasyliev
ValeriiVasyliev / wp-config.php
Created January 23, 2019 17:41
Set WordPress site URL in the config file instead of the database
<?php
// WordPress stores the site URL in the database by default (which I have never
// understood), and it's a pain to have to type out the UPDATE SQL or search in
// phpMyAdmin to change it. This is a simple way to put the URL into
// wp-config.php instead.
// Note that you will still need to update any URLs that appear in the content,
// especially when you copy a database from a development site to production:
// https://gist.github.com/davejamesmiller/a8733a3fbb17e0ff0fb5
@ValeriiVasyliev
ValeriiVasyliev / function.php
Created April 16, 2019 15:12 — forked from mattclements/function.php
Wordpress Disable Comments (add to function.php)
<?php
// Add to existing function.php file
// Disable support for comments and trackbacks in post types
function df_disable_comments_post_types_support() {
$post_types = get_post_types();
foreach ($post_types as $post_type) {
if(post_type_supports($post_type, 'comments')) {
remove_post_type_support($post_type, 'comments');

Optimizations and enhancements for prestashop 1.6

Sometimes, prestashop turns very slow due to ads, and module recomendations. Here are some modifications to version 1.6 removing these things and speed up the admin panels. Enjoy and share your tricks about how optimize prestashop.

Modify Tools class

[https://github.com/PrestaShop/PrestaShop/blob/1.6.1.x/classes/Tools.php#L3351-L3356] Find the file /public/classes/Tools.php and modify as next:

public static function addonsRequest($request, $params = array())
@ValeriiVasyliev
ValeriiVasyliev / acf-get-field-key.php
Created July 4, 2019 08:30 — forked from mcguffin/acf-get-field-key.php
WordPress Advanced Custom Fields get field key from field name
<?php
/**
* Get field key for field name.
* Will return first matched acf field key for a give field name.
*
* ACF somehow requires a field key, where a sane developer would prefer a human readable field name.
* http://www.advancedcustomfields.com/resources/update_field/#field_key-vs%20field_name
*
* This function will return the field_key of a certain field.