Skip to content

Instantly share code, notes, and snippets.


Page Carbajal Page-Carbajal

View GitHub Profile

Import values from a related table

UPDATE wp_posts AS posts,
	(SELECT post_id, meta_value FROM wp_postmeta 
		WHERE meta_key = 'wpcf-p-desc') AS meta
	SET posts.post_content = meta.meta_value
WHERE posts.ID = meta.post_id
AND posts.post_content = ''

Tres tipos diferentes de templates

1. Preconfigurado


while( have_posts() ){
Page-Carbajal / jquery-injection.js
Created May 14, 2018
Injecting jQuery on Runtime
View jquery-injection.js
// Force jQuery Injection
if( 'undefined' === typeof jQuery ){
var head = document.getElementsByTagName("head")[0];
var customScript = document.createElement("script");
customScript.src = scriptSource;
customScript.onload = function(){
if( jQuery ){
/******** Start writing you jQuery code here ************/
Page-Carbajal / functions.php
Created Jun 17, 2016
WordPress - How to dynamically load scripts and styles based on post content
View functions.php
function justIfContentHas()
global $post;
// Set the condition for loading your resources
if( has_shortcode($post->post_content, 'my_short_code') ){
View static_bindings_test.php
// Late Static Binding in PHP are great.
// However they are not supported in every version of PHP
// Use the code below in a new window to test support
// for Late Static Bindings inside closures.
abstract class Demo
protected $item;

#Git Archive

##Archive HEAD

$ git archive HEAD --format=zip -o /path/to/

Page-Carbajal / Override nested dependencies with Composer.json
Last active Feb 11, 2016
Override nested dependencies with Composer
View Override nested dependencies with Composer.json
"name": "page-carbajal/my-awesome-package",
"description": "My Awesome Package",
"type": "Plugin",
"authors": [
"name": "Page Carbajal",
"email": ""
Page-Carbajal / ext-xdebug.ini
Created Jan 4, 2016
XDebug Sample Configuration
View ext-xdebug.ini
xdebug.profiler_output_name = xdebug.profiler.%H.%t
Page-Carbajal /
Last active Oct 25, 2019
Publishing a Git Repository to WordPress with SVN

From a Git Repository to WordPress SVN

Well this is kind of fun right. Specially since must of us have not used SVN for over 10 years.

Lets do this. Our objective here is to create a common codebase for both SVN and Git.

Process for empty SVN Project

Doing this is not that complicated