Skip to content

Instantly share code, notes, and snippets.

Avatar

David Perez davidperezgar

View GitHub Profile
View vertical-align.css
.element {
position: relative;
top: 50%;
transform: translateY(-50%);
}
@davidperezgar
davidperezgar / gist:4f15ef2f133f7f6c3d93
Created Jan 12, 2015
Not Load CSS and don't promote for WPML Plugin in functions file
View gist:4f15ef2f133f7f6c3d93
<?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 Jan 14, 2015
Create Wordpress Pages when activates a theme
View gist:4e1ca49d12c34876d426
//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);
View add-wc-order-status.php
/**
* 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,
View .htaccess
<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 Aug 29, 2015 — forked from BFTrick/functions.php
Wp Dequeue Styles and Scripts in functions child theme
View functions.php
//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( '' );
}
View add-wc-order-status.php
/**
* 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,
View sugarcrm-api-php-create.php
<?php
$url = "http://{site_url}/service/v4_1/rest.php";
$username = "admin";
$password = "password";
//function to make cURL request
function call($method, $parameters, $url)
{
ob_start();
View retrieve_list_fields.php
<?php
$url = "http://{site_url}/service/v4_1/rest.php";
$username = "admin";
$password = "password";
function call($method, $parameters, $url)
{
ob_start();
$curl_request = curl_init();
View relacionados-post2-posts.php
$connected = new WP_Query( array(
'connected_type' => 'proyectos_a_sectores',
'connected_items' => get_post($post->post_parent),
'nopaging' => true,
) );