Skip to content

Instantly share code, notes, and snippets.

View edpittol's full-sized avatar
👻
Buuuhhh!!!

Eduardo Pittol edpittol

👻
Buuuhhh!!!
  • Aztec Online Solutions
  • Lajeado, RS, Brasil
  • X @edpittol
View GitHub Profile
@edpittol
edpittol / export-table.php
Created December 13, 2023 14:26
Script extracts WordPress table data via WP-CLI, handles provided table name as argument, queries database, outputs CSV format through eval-file command in WP-CLI
<?php
/**
* Export WordPress table data using WP-CLI eval-file command.
* Usage: wp eval-file export-table.php your_table_name_here
*/
if (!defined('WP_CLI') || !WP_CLI) {
echo "This script is intended to be used with WP-CLI.\n";
return;
}
@edpittol
edpittol / wpcli_remove_media_not_fs_files
Created May 3, 2019 17:15
WP-CLI: Remove all media in the database that isn't on the filesystem.
wp db query "SELECT post_id, meta_value FROM wp_postmeta WHERE meta_key='_wp_attached_file'" --skip-column-names | \
paste -s -d '\n' - | \
xargs -n 2 bash -c '\
FILE=wp-content/uploads/$2; \
[[ ! -f ${FILE} ]] && echo $1; \
' argv0 | \
sed -e 'H;${x;s/\n/,/g;s/^,//;p;};d' |
xargs -i bash -c 'wp db query " \
DELETE p, pm, tr \
FROM wp_posts p \
/**
* Add Flower font to the theme options font list.
*
* @param array $custom_fonts Current custom fonts.
* @return string[string][string] The Web fonts section.
*/
function mytheme_redux_custom_fonts( $custom_fonts ) {
return array(
'Web Fonts' => array(
‘flower' => 'flower'
@edpittol
edpittol / 0_reuse_code.js
Last active August 29, 2015 14:25
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@edpittol
edpittol / gist:3492b086affcc5100708
Created September 14, 2014 04:49
Parse Facebook Login
// Initialize the Facebook SDK with Parse as described at
// https://parse.com/docs/js_guide#fbusers
window.fbAsyncInit = function() {
// init the FB JS SDK
Parse.FacebookUtils.init({
appId : '289802934544559', // Facebook App ID
cookie : true, // enable cookies to allow the server to access
// the session
xfbml : true, // parse social plugins on this page
version : 'v1.0' // use version 1
{% stylesheets
'@MopaBootstrapBundle/Resources/public/less/mopabootstrapbundle-fa.less'
'@MopaBootstrapBundle/Resources/public/less/eyecon-bootstrap-datepicker.less'
%}
<link href="{{ asset_url }}" type="text/css" rel="stylesheet" media="screen" />
{% endstylesheets %}