Skip to content

Instantly share code, notes, and snippets.

View pedrorvidal's full-sized avatar
🎯
Focusing

Pedro Vidal pedrorvidal

🎯
Focusing
View GitHub Profile
@pedrorvidal
pedrorvidal / gist:bb97b3a9711c54b3aca411380028ce86
Created January 30, 2017 19:50 — forked from danielbachhuber/gist:7126249
Include posts from authors in the search results where either their display name or user login matches the query string
<?php
/**
* Include posts from authors in the search results where
* either their display name or user login matches the query string
*
* @author danielbachhuber
*/
add_filter( 'posts_search', 'db_filter_authors_search' );
function db_filter_authors_search( $posts_search ) {
@pedrorvidal
pedrorvidal / Gruntfile.js
Created July 6, 2016 19:32 — forked from jshawl/Gruntfile.js
Grunt + Sass + Autoprefixer
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
dist: {
options:{
style:'compressed'
},
files: {
'css/style.css' : 'scss/style.scss'
@pedrorvidal
pedrorvidal / wordpress-post-thumbnail-or-first-image-or-default.php
Last active August 29, 2015 14:26 — forked from brajeshwar/wordpress-post-thumbnail-or-first-image-or-default.php
Wordpress - Get the Image from Post Thumbnail or the First Image of a post or else use a default Image.
/*
* Display Image from the_post_thumbnail or the first image of a post else display a default Image
* Chose the size from "thumbnail", "medium", "large", "full" or your own defined size using filters.
* USAGE: <?php echo my_image_display(); ?>
*/
function my_image_display($size = 'full') {
if (has_post_thumbnail()) {
$image_id = get_post_thumbnail_id();
$image_url = wp_get_attachment_image_src($image_id, $size);
#GIT#
git checkout -b branch-name master
git status
git add <some-file>
git commit
git push -u origin branch-name
#!/bin/bash
# requires lynx,grep,awk,uniq,sort,egrep,head,xargs,wget,tar adn rm
lynx -dump http://br.wordpress.org/releases | /bin/grep "\.tar\.gz$" | awk -F'http://' '{ print "http://"$2 }' | uniq | sort -r | /bin/egrep -v 'RC|beta' | head -n1 | xargs wget -O wordpress-br.tar.gz
tar -xvf wordpress-br.tar.gz
/bin/rm wordpress-br.tar.gz