Skip to content

Instantly share code, notes, and snippets.

@tacensi
tacensi / sublime-text-config
Last active November 25, 2018 19:37
My Sublime Text configuration file
// Settings in here override those in "Default/Preferences.sublime-settings", and
// are overridden in turn by file type specific settings.
{
"auto_complete_commit_on_tab": true,
"auto_indent": true,
"bold_folder_labels": true,
"caret_style": "phase",
"create_window_at_startup": false,
@tacensi
tacensi / .vimrc
Last active March 9, 2019 12:44
vimrc file
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Maintainer:
" Amir Salihefendic
" http://amix.dk - amix@amix.dk
"
" Version:
" 5.0 - 29/05/12 15:43:36
"
" Blog_post:
" http://amix.dk/blog/post/19691#The-ultimate-Vim-configuration-on-Github
@tacensi
tacensi / gist:10427782
Last active August 29, 2015 13:58 — forked from liamcurry/gist:2597326
Vanilla vs jQuery

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@tacensi
tacensi / wp_load_template
Created July 7, 2014 13:43
WP Load specific template file
add_filter( 'template_include', function( $template ) {
return locate_template( 'index.php' );
} );
@tacensi
tacensi / HTML5 Template
Last active August 29, 2015 14:03
html5 template
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="">
@tacensi
tacensi / wp-cpt
Created October 27, 2014 14:07
WP New Custom Post Type
function mg_dicas() {
$labels = array(
'name' => 'Dicas',
'singular_name' => 'Dica',
'menu_name' => 'Dicas',
'parent_item_colon' => 'Dica mãe:',
'all_items' => 'Todas dicas',
'view_item' => 'Ver dica',
'add_new_item' => 'Adicionar dica',
@tacensi
tacensi / WP Slug to body class
Created October 27, 2014 17:52
Adding the page slug to body_class()
// Adding page slug to body class
function add_slug_body_class( $classes ) {
global $post;
if ( isset( $post ) ) {
$classes[] = $post->post_name;
}
return $classes;
}
add_filter( 'body_class', 'add_slug_body_class' );
@tacensi
tacensi / ACF Options Menu & Subpages
Created January 16, 2015 16:46
ACF Option Menu and subpages
// Options pages
function my_acf_options_page_settings( $settings ){
$settings['title'] = 'Opções';
$settings['pages'] = array( 'Subpágina 1', 'Subpágina 3', 'Subpágina 2' );
return $settings;
}
add_filter('acf/options_page/settings', 'my_acf_options_page_settings');
@tacensi
tacensi / ACF Options page as submenu
Created January 16, 2015 16:51
Put the options page inside another WP menu (posts, pages, etc.)
if ( function_exists( 'acf_add_options_sub_page' ) ){
acf_add_options_sub_page(
array(
'title' => 'Destaques',
'parent' => 'edit.php',
'capability' => 'publish_posts'
)
);
}
@tacensi
tacensi / scrollTop
Created February 12, 2015 13:54
JQuery Scroll Top Animated
try{
$('.backtop').click( function(e){
e.preventDefault();
$('html,body').animate({
scrollTop: '0px'
}, 800 );
})
} catch(e){
console.log(e);
}