Skip to content

Instantly share code, notes, and snippets.

View badah's full-sized avatar

Daniel Hernandes badah

View GitHub Profile
@badah
badah / Gruntfile.js
Last active January 27, 2016 13:41
Grunt: bones Gruntfile.js sample
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
compass: {
dist: {
options: {
@badah
badah / sublime-project.json
Last active October 24, 2018 21:21
Sublime: WordPress project example
{
"folders": [
{
"path": ".",
"folder_exclude_patterns": [
".sass-cache",
"node_modules",
".phpintel",
".settings",
"dist",
@badah
badah / nav-justified.scss
Created July 19, 2015 04:35
Sass: Justified navigation menu
.nav {
font-size: 14px;
font-weight: bold;
a {
color: white;
&:hover, &:focus {
color: black;
}
}
@badah
badah / .gitignore
Last active April 27, 2018 22:49
Git: Ignore files
############
## IDEs
############
*.pydevproject
.project
.metadata
*.swp
*~.nib
local.properties
@badah
badah / gist:e472f34b5cafedac79ef
Created July 12, 2015 19:09
Wordpress: render shortcode in proper place
// Use the following snipet to render shortcode proper in a Wordpress theme
function myfunction_func() {
// code goes here
}
function myfunction_func_buffer() {
ob_start();
myfunction_func();
@badah
badah / gist:e925ab0a03f2bd68721f
Last active August 29, 2015 14:11
Wordpress: Remove Jetpack CSS
<?php get_header(); ?>
<div id="content">
<div id="inner-content" class="wrap cf">
<div id="main" class="m-all t-all d-all cf" role="main">
<!-- TODO: O que é? O que faz (tagline, descrição curta) -->
@badah
badah / gist:fb9638029191e5ef40ad
Last active August 29, 2015 14:09
Wordpress: get date from date custom field
<?php
//PHP > 5.3
$date = DateTime::createFromFormat('Ymd', get_field('date'));
echo $date->format('d/m');
//PHP < 5.3
$date = get_field('date');
// extract d/m
@badah
badah / change-worpress-urls.sql
Last active March 16, 2023 19:04
SQl: Change Wordpress URL after migration
#URLs
UPDATE wp_options SET option_value = replace(option_value, 'http://oldurl.com', 'http://newurl.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://oldurl.com','http://newurl.com');
UPDATE wp_posts SET post_content = replace(post_content, 'http://oldurl.com', 'http://newurl.com');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://oldurl.com','http://newurl.com');
#Media
UPDATE wp_posts SET `guid` = REPLACE (`guid`, 'http://oldurl.com', 'http://newurl.com') WHERE post_type = 'attachment';
@badah
badah / gist:ac6b0cfe6636f80973ba
Last active November 4, 2015 12:52
Wordpress: Change query properties
/*
Change query properties
*/
function badah_change_query( $query ) {
if ( !is_admin() && $query->is_main_query() ) {
if ( $query->is_front_page() ) {
$query->set( 'showposts', 1 ); // whatever
}
}
@badah
badah / searchform.php
Last active August 29, 2015 14:06
Wordpress: custom searchform
<form role="search" method="get" class="searchform" id="searchform" action="<?php echo home_url( '/' ); ?>">
<div><label class="screen-reader-text" for="s"><?php _e('Search for:', 'bonestheme') ?></label>
<input type="text" value="" placeholder="<?php _e( 'Search this site', 'bonestheme' )?>" name="s" id="s" />
<input type="submit" id="searchsubmit" value="Submit" />
</div>
</form>