Skip to content

Instantly share code, notes, and snippets.

View nicolabavaro's full-sized avatar

Nicola Bavaro nicolabavaro

View GitHub Profile
// Transparent navbar
//
// Reset transparent navbar basics
@navbar-transparent-color: transparent;
@navbar-transparent-bg: transparent;
@navbar-transparent-border: transparent;
// Transparent navbar links
@navbar-transparent-link-color: #fff;
@navbar-transparent-link-hover-color: #fff;
@nicolabavaro
nicolabavaro / Jquery Redirect
Created July 2, 2015 13:33
Redirect by Language
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript">
$( document ).ready(function(){
var userLang = navigator.language || navigator.userLanguage;
if (userLang == "it") {
window.location.href = "http://www.neber.it/area-riservata/area-riservata.html"
}
else {
window.location.href = "http://www.neber.it/area-riservata/area-riservata-en.html"
}
@nicolabavaro
nicolabavaro / gist:d62b3b7f5dcd1d2dbebb
Created July 13, 2015 12:43
Query MySQL per cambio dominio Wordpress
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl');
<?php
/* --------------------------------------------------------------------
:: Auto-Includer
Loads PHP files from the /includes/ directory. For WordPress sites,
this code would go in your functions.php file.
-------------------------------------------------------------------- */
foreach (glob(__DIR__ . '/includes/*.php') as $my_theme_filename) {
@nicolabavaro
nicolabavaro / wp-shell-install.sh
Created October 9, 2015 07:46 — forked from dongilbert/wp-shell-install.sh
Auto Install Latest WordPress from Shell
#!/bin/bash
# Install script for Latest WordPress by Johnathan Williamson - extended by Don Gilbert
# Disclaimer: It might not bloody work
# Disclaimer 2: I'm not responsible for any screwups ... :)
# DB Variables
echo "MySQL Host:"
read mysqlhost
export mysqlhost
@nicolabavaro
nicolabavaro / wp.sh
Created October 9, 2015 07:50 — forked from bgallagh3r/wp.sh
Wordpress: Bash Install Script -- Downloads latest WP version, updates wp-config with user supplied DB name, username and password, creates and CHMOD's uploads dir, copies all the files into the root dir you run the script from, then deletes itself!
#!/bin/bash -e
clear
echo "============================================"
echo "WordPress Install Script"
echo "============================================"
echo "Database Name: "
read -e dbname
echo "Database User: "
read -e dbuser
echo "Database Password: "
@nicolabavaro
nicolabavaro / gist:307981365280702cb9ec7e00c608a9af
Created April 4, 2016 08:36
Remove Content Editor on Product Editor Page
function remove_product_editor() {
remove_post_type_support( 'product', 'editor' );
}
add_action( 'init', 'remove_product_editor' );
@nicolabavaro
nicolabavaro / add-vc-grid-element.php
Created February 16, 2017 17:05
Create a custom element fo visual Composer Grid Builder
// _dt_fancy_header_bg_image
add_filter( 'vc_gitem_template_attribute_fancy_image', 'vc_gitem_template_attribute_fancy_image', 10, 2 );
function vc_gitem_template_attribute_fancy_image( $value, $data ) {
/**
* @var Wp_Post $post
* @var string $data
*/
global $post;
add_action( 'get_header', 'dt_media_sidebar', 10 );
function dt_media_sidebar() {
$config = Presscore_Config::get_instance();
if(is_singular( 'post' )){
$config->set( 'sidebar_position', 'left' ); //to change sidebar postion
$config->set( 'sidebar_widgetarea_id', 'sidebar_1' ); //repalce with sidebar widget area id
}
@nicolabavaro
nicolabavaro / functions.php
Created February 20, 2017 10:05 — forked from thecodepoetry/functions.php
remove meta info in search results
add_action( 'get_header', 'dt_archive_layout', 10 );
function dt_archive_layout() {
$config = Presscore_Config::get_instance();
if(is_search() ){
$config->set( 'post.meta.fields.date', '0' );
$config->set( 'post.meta.fields.categories', '0' );
$config->set( 'post.meta.fields.comments', '0' );