Skip to content

Instantly share code, notes, and snippets.

Marcio Duarte pagelab

Block or report user

Report or block pagelab

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pagelab
pagelab / functions.php
Created Aug 12, 2019 — forked from tessak22/functions.php
Hero Gutenberg Block using Advanced Custom Fields 5.8 Pro
View functions.php
/**
* Register hero block
*/
add_action('acf/init', 'hero');
function hero() {
// check function exists
if( function_exists('acf_register_block') ) {
// register a hero block
@pagelab
pagelab / wp-mailhog.php
Created Aug 5, 2019 — forked from bishless/wp-mailhog.php
Configure WordPress on Valet to use MailHog
View wp-mailhog.php
<?php
/**
* @link
* @since 1.0.0
* @package TODO
*
* @wordpress-plugin
* Plugin Name: Use MailHog
* Description: Configure WordPress on Valet to use MailHog
* Version: 1.0.0
View edd-webhook-handler.php
<?php
/*
Plugin Name: EDD Webhooks
Description: Captures new sale notifications from 3rd party service and adds to Easy Digital Downloads
Version: 1.0
Author: Brian Hogg
Author URI: https://brianhogg.com
Text Domain: edd-webhooks
License: GPL2
*/
@pagelab
pagelab / git-pushing-multiple.rst
Created Jul 21, 2019 — forked from rvl/git-pushing-multiple.rst
How to push to multiple git remotes at once. Useful if you keep mirrors of your repo.
View git-pushing-multiple.rst

Pushing to Multiple Git Repos

If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.

Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.

If in doubt about what git is doing when you run these commands, just

@pagelab
pagelab / functions.php
Created Jul 18, 2019 — forked from cliffordp/functions.php
Automatically login a single WordPress user upon arrival to a specific page.
View functions.php
<?php
/**
* Automatically login a single WordPress user upon arrival to a specific page.
*
* Redirect to home page once logged in and prevent viewing of the login page.
* Compatible with WordPress 3.9.1+
* Updated 2014-07-18 to resolve WP_DEBUG notice: "get_userdatabylogin is deprecated since version 3.3! Use get_user_by('login') instead."
* Updated 2019-07-09 to reformat code, pass 2nd parameter to `do_action()`, and hook into priority 1.
*
@pagelab
pagelab / copy-pre.css
Created Jul 15, 2019 — forked from stephenharris/copy-pre.css
Adding a 'copy' button to <pre> content
View copy-pre.css
.pre-wrapper{
position:relative;
}
.pre-wrapper pre{
padding-top: 25px;
}
.pre-wrapper .copy-snippet {
border-radius: 0;
min-width:55px;
background: none repeat scroll 0 0 transparent;
@pagelab
pagelab / mobtable.html
Created Jun 11, 2019 — forked from hkirsman/mobtable.html
turn tables into mobile friendly
View mobtable.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="et">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>table</title>
<style type="text/css">
.odd { background-color: #808080; }
.generated_for_mobile { margin-bottom: 30px }
@pagelab
pagelab / wpquery.php
Created May 23, 2019
Referência completa do WP_Query
View wpquery.php
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
//////Author Parameters - Show posts associated with certain author.
@pagelab
pagelab / trim-excerpt-whitespace.php
Created Apr 24, 2019 — forked from mindpalette/trim-excerpt-whitespace.php
WordPress Filter - Trim Excerpt Whitespace
View trim-excerpt-whitespace.php
<?php
// trim excerpt whitespace
if ( !function_exists( 'mp_trim_excerpt_whitespace' ) ) {
function mp_trim_excerpt_whitespace( $excerpt ) {
return trim( $excerpt );
}
add_filter( 'get_the_excerpt', 'mp_trim_excerpt_whitespace', 1 );
}
@pagelab
pagelab / wp-update.sh
Created Jan 24, 2019 — forked from bananana/wp-update.sh
Bash script to run automatic updates and backups using wp-cli
View wp-update.sh
#!/bin/bash
#
# Backup and update WordPress using wp-cli
#
# Set the -e shell option so the script exits immediately if any command within
# it exits with a non-zero status.
set -e
# Set PATH environment variable
You can’t perform that action at this time.