Skip to content

Instantly share code, notes, and snippets.

View davidperezgar's full-sized avatar

David Perez davidperezgar

View GitHub Profile
@davidperezgar
davidperezgar / htaccess-301-redirection
Created March 12, 2015 11:51
Redirection 301 htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
redirectMatch 301 ^(.*)$ http://www.$1
</IfModule>
@davidperezgar
davidperezgar / footer.php
Created April 7, 2015 21:52
Placeholder for Wordpres login
@davidperezgar
davidperezgar / script-wrapper
Created April 15, 2015 10:11
Javascript Wrapper for Wordpress
<script type="application/javascript">
(function ($) {
}(jQuery));
</script>
@davidperezgar
davidperezgar / how-to-use-posts-2-posts
Created April 15, 2015 20:44
Posts 2 posts functions for WordPress
<?php
//In functions .php
function my_connection_types() {
p2p_register_connection_type( array(
'name' => 'posts_to_pages',
'from' => 'post',
'to' => 'page'
) );
}
add_action( 'p2p_init', 'my_connection_types' );
@davidperezgar
davidperezgar / wp-oembed-defaults.php
Created October 28, 2015 23:44
Oembed dimensions defaults in Wordpress
add_filter('embed_defaults','themename_embed_defaults');
function themename_embed_defaults($defaults) {
$defaults['width']=123;
$defaults['height']=123;
return $defaults;
}
@davidperezgar
davidperezgar / wp-config-snippet-debug.php
Created November 3, 2015 11:36
WP Debug Active to a file - Recommended for Woocommerce
// Activate WP_DEBUG to a file
// file: /wp-content/uploads/debug.log
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
@ini_set('display_errors',0);
define('SCRIPT_DEBUG', true);
@davidperezgar
davidperezgar / media-queries-bootstrap
Last active November 9, 2015 21:31
Media Query Bootstrap
/*Media Queries*/
@media only screen and (min-width: 801px) and (max-width: 980px) {
}
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : portrait) {
}
@media only screen
@davidperezgar
davidperezgar / wordpress-font-awesome-ie7-cdn.php
Created November 16, 2015 23:33 — forked from robneu/wordpress-font-awesome-ie7-cdn.php
Add Font Awesome With IE7 Support to WordPress using a CDN
<?php
/**
* Registers and loads font awesome
* CSS files using a CDN.
*
* @link http://www.bootstrapcdn.com/#tab_fontawesome
* @author FAT Media
*/
add_action( 'wp_enqueue_scripts', 'prefix_enqueue_awesome' );
/**
@davidperezgar
davidperezgar / functions-disable-apperance.php
Created November 23, 2015 23:22
Disable Wordpress Appearance and Plugins for users
//Disable Appearance and Plugins for users
function remove_menus(){
remove_menu_page( 'themes.php' ); //Appearance
remove_menu_page( 'plugins.php' ); //Plugins
}
add_action( 'admin_menu', 'remove_menus' );
@davidperezgar
davidperezgar / gist:6bb9d7f18b1ace430dbc
Created December 3, 2015 13:03 — forked from billerickson/gist:1493758
Gallery metabox - custom post types
<?php
/**
* Gallery Metabox - Only show on 'page' and 'rotator' post types
* @author Bill Erickson
* @link http://www.wordpress.org/extend/plugins/gallery-metabox
* @link http://www.billerickson.net/code/gallery-metabox-custom-post-types
* @since 1.0
*
* @param array $post_types