Skip to content

Instantly share code, notes, and snippets.

David Perez davidperezgar

Block or report user

Report or block davidperezgar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View htaccess-301-redirection
<IfModule mod_rewrite.c>
RewriteEngine On
redirectMatch 301 ^(.*)$ http://www.$1
</IfModule>
@davidperezgar
davidperezgar / footer.php
Created Apr 7, 2015
Placeholder for Wordpres login
View footer.php
@davidperezgar
davidperezgar / script-wrapper
Created Apr 15, 2015
Javascript Wrapper for Wordpress
View script-wrapper
<script type="application/javascript">
(function ($) {
}(jQuery));
</script>
@davidperezgar
davidperezgar / how-to-use-posts-2-posts
Created Apr 15, 2015
Posts 2 posts functions for WordPress
View how-to-use-posts-2-posts
<?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 Oct 28, 2015
Oembed dimensions defaults in Wordpress
View wp-oembed-defaults.php
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 Nov 3, 2015
WP Debug Active to a file - Recommended for Woocommerce
View wp-config-snippet-debug.php
// 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);
View media-queries-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 Nov 16, 2015 — forked from robneu/wordpress-font-awesome-ie7-cdn.php
Add Font Awesome With IE7 Support to WordPress using a CDN
View wordpress-font-awesome-ie7-cdn.php
<?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 Nov 23, 2015
Disable Wordpress Appearance and Plugins for users
View functions-disable-apperance.php
//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 Dec 3, 2015 — forked from billerickson/gist:1493758
Gallery metabox - custom post types
View gist:6bb9d7f18b1ace430dbc
<?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
You can’t perform that action at this time.