Skip to content

Instantly share code, notes, and snippets.

View davidperezgar's full-sized avatar

David Perez davidperezgar

View GitHub Profile
.element {
position: relative;
top: 50%;
transform: translateY(-50%);
}
@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,
<?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();
<?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();
@davidperezgar
davidperezgar / relacionados-post2-posts.php
Created March 3, 2015 09:03
Posts 2 posts related with ID
$connected = new WP_Query( array(
'connected_type' => 'proyectos_a_sectores',
'connected_items' => get_post($post->post_parent),
'nopaging' => true,
) );