Skip to content

Instantly share code, notes, and snippets.

View mae829's full-sized avatar

Miguel A. Estrada mae829

View GitHub Profile
@tankchintan
tankchintan / prestitial.js
Created May 8, 2015 15:43
dfp > prestitial oop solution > prestitial javascript
var DfpOutOfPageAdGenerator = DfpOutOfPageAdGenerator || {};
DfpOutOfPageAdGenerator.Prestitial = Class.extend({
properties: {
isAdSkippedManually: false,
dfpCreativeMarkup: undefined,
dfpCreativeParameters: undefined
},
@tankchintan
tankchintan / prestitial.less
Created May 8, 2015 15:45
dfp > prestitial oop solution > style
@import '../libs/prefixer.less';
@min-z-index: 10000001;
.no-scroll {
overflow: hidden;
}
#prestitial-ad-overlay {
position: fixed;
@sudar
sudar / error_msg.php
Created June 27, 2015 08:10
Creating single select WordPress taxonomies. Explanation at http://sudarmuthu.com/blog/creating-single-select-wordpress-taxonomies/
<?php
/**
* Display an error message at the top of the post edit screen explaining that ratings is required.
*
* Doing this prevents users from getting confused when their new posts aren't published, as we
* require a valid rating custom taxonomy.
*
* @param WP_Post The current post object.
*/
function show_required_field_error_msg( $post ) {
@zach-adams
zach-adams / Vagrantfile
Last active April 13, 2018 22:52
A modified Vagrantfile to tell VVV to run import-sql script on up
# Vagrant Triggers
#
# If the vagrant-triggers plugin is installed, we can run various scripts on Vagrant
# state changes like `vagrant up`, `vagrant halt`, `vagrant suspend`, and `vagrant destroy`
#
# These scripts are run on the host machine, so we use `vagrant ssh` to tunnel back
# into the VM and execute things. By default, each of these scripts calls db_backup
# to create backups of all current databases. This can be overridden with custom
# scripting. See the individual files in config/homebin/ for details.
if defined? VagrantPlugins::Triggers
@zach-adams
zach-adams / sync-sql.sh
Created July 15, 2015 17:04
A copy of import-sql.sh with edits to refresh databases on vagrant up
#!/bin/bash
#
# Sync the sql files in the sync folder
#
# The files in the {vvv-dir}/database/sync/ directory should be created by
# mysqldump or some other export process that generates a full set of SQL commands
# to create the necessary tables and data required by a database.
#
# For a sync to work properly, the SQL file should be named `db_name.sql` in which
# `db_name` matches the name of a database already created in {vvv-dir}/database/init-custom.sql
@zach-adams
zach-adams / vagrant_halt_custom
Created July 15, 2015 17:07
A copy of the db_backup script that automatically copies the backups to the sync folder
#!/bin/bash
#
# Create individual SQL files for each database. These files
# are imported automatically during an initial provision if
# the databases exist per the import-sql.sh process.
mysql -e 'show databases' | \
grep -v -F "information_schema" | \
grep -v -F "performance_schema" | \
grep -v -F "mysql" | \
grep -v -F "test" | \
@ms-studio
ms-studio / add-term-to-custom-taxonomy.php
Created December 15, 2015 08:10
add term metabox to custom taxonomy - using WP 4.4 term meta functions
<?php
// source: http://wordpress.stackexchange.com/questions/211703/need-a-simple-but-complete-example-of-adding-metabox-to-taxonomy
// code authored by jgraup - http://wordpress.stackexchange.com/users/84219/jgraup
// CREATE CUSTOM TAXONOMY
add_action( 'init', '___create_my_custom_tax' );
@igorbenic
igorbenic / code.php
Last active February 21, 2024 21:32
How to create WordPress Metaboxes with OOP
<?php
class IBenic_WordPress_Metabox extends WordPressSettings {
protected $title = '';
protected $slug = '';
protected $post_types = array();
@ajskelton
ajskelton / WP Customizer - Dropdown-pages
Last active February 13, 2023 08:04
Add a Dropdown-pages field to the WordPress Customizer.
$wp_customize->add_setting( 'themeslug_dropdownpages_setting_id', array(
'capability' => 'edit_theme_options',
'sanitize_callback' => 'themeslug_sanitize_dropdown_pages',
) );
$wp_customize->add_control( 'themeslug_dropdownpages_setting_id', array(
'type' => 'dropdown-pages',
'section' => 'custom_section', // Add a default or your own section
'label' => __( 'Custom Dropdown Pages' ),
'description' => __( 'This is a custom dropdown pages option.' ),
@anttiviljami
anttiviljami / wp-admin-modal-dialog.php
Last active January 5, 2024 14:25
WordPress admin modal dialog example
<?php
// enqueue these scripts and styles before admin_head
wp_enqueue_script( 'jquery-ui-dialog' ); // jquery and jquery-ui should be dependencies, didn't check though...
wp_enqueue_style( 'wp-jquery-ui-dialog' );
?>
<!-- The modal / dialog box, hidden somewhere near the footer -->
<div id="my-dialog" class="hidden" style="max-width:800px">
<h3>Dialog content</h3>
<p>This is some terribly exciting content inside this dialog. Don't you agree?</p>