Skip to content

Instantly share code, notes, and snippets.

View davidperezgar's full-sized avatar

David Perez davidperezgar

View GitHub Profile
<?php
/**
* Display how many spots are left in the choice label when using the GP Limit Choices perk
* http://gravitywiz.com/gravity-perks/
*/
add_filter( 'gplc_remove_choices', '__return_false' );
add_filter( 'gplc_pre_render_choice', 'my_add_how_many_left_message', 10, 4 );
@davidperezgar
davidperezgar / gravityforms-php-code.php
Last active January 11, 2016 10:14
Gravity Forms PHP
<?php gravity_form($id_or_title, $display_title=true, $display_description=true, $display_inactive=false, $field_values=null, $ajax=false, $tabindex); ?>
<?php //default values: ?>
<?php gravity_form(1, true, true, false, null, false, 0); ?>
.element {
position: relative;
top: 50%;
transform: translateY(-50%);
}
@davidperezgar
davidperezgar / .gitignore
Last active September 8, 2016 11:06 — forked from octocat/.gitignore
Gitignore for Wordpress Pages
#Wordpress
htaccess.txt
index.php
licencia.txt
license.txt
readme.html
robots.txt
wp-activate.php
wp-admin/
wp-blog-header.php
@davidperezgar
davidperezgar / gist:4f15ef2f133f7f6c3d93
Created January 12, 2015 22:59
Not Load CSS and don't promote for WPML Plugin in functions file
<?php
//Not load JS and CSS
define('ICL_DONT_LOAD_NAVIGATION_CSS', true);
define('ICL_DONT_LOAD_LANGUAGE_SELECTOR_CSS', true);
define('ICL_DONT_LOAD_LANGUAGES_JS', true);
//Not Load advertising
define("ICL_DONT_PROMOTE", true);
@davidperezgar
davidperezgar / gist:4e1ca49d12c34876d426
Created January 14, 2015 13:25
Create Wordpress Pages when activates a theme
//Página de creación automática
if (isset($_GET['activated']) && is_admin()){
$new_page_title = 'Título de la página';
$new_page_content = 'Aquí va el contenido de la página, por supuesto puedes añadir HTML a voluntad';
$new_page_template = ''; //nombre del archivo de plantilla de página personalizada, por ejemplo: plantilla-personalizada.php. Déjalo en blanco si no quieres crear una plantilla de página personalizada.
//No cambies el código que viene a continuación a menos que sepas realmente lo que estás haciendo
$page_check = get_page_by_title($new_page_title);
/**
* Register new status
* Tutorial: http://www.sellwithwp.com/woocommerce-custom-order-status-2/
**/
function register_awaiting_shipment_order_status() {
register_post_status( 'wc-awaiting-shipment', array(
'label' => 'Awaiting shipment',
'public' => true,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.mysite.com/$1 [R,L]
</IfModule>
@davidperezgar
davidperezgar / functions.php
Last active August 29, 2015 14:14 — forked from BFTrick/functions.php
Wp Dequeue Styles and Scripts in functions child theme
//dequeue css from plugins
add_action('wp_print_styles', 'mytheme_dequeue_css_from_plugins', 100);
function mytheme_dequeue_css_from_plugins() {
wp_dequeue_style( '' );
}
add_action('wp_print_scripts','mytheme_dequeue_js_from_plugins');
function mytheme_dequeue_js_from_plugins() {
wp_dequeue_script( '' );
}
/**
* Register new status
* Tutorial: http://www.sellwithwp.com/woocommerce-custom-order-status-2/
**/
function register_awaiting_shipment_order_status() {
register_post_status( 'wc-awaiting-shipment', array(
'label' => 'Awaiting shipment',
'public' => true,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,