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
@davidperezgar
davidperezgar / content-latestposts.php
Created Dec 24, 2014
Latests posts with bootstrap
View content-latestposts.php
<div class="row latestposts">
<?php
$args = array(
'posts_per_page' => 2
);
$postlist =get_posts($args);
foreach($postlist as $post){
setup_postdata( $post );
?>
View cpt-mobiliario.php
<?php
/**
* Custom Post Types Mobiliario
*
*/
add_action('init', 'my_custom_init_mob');
function my_custom_init_mob()
{
@davidperezgar
davidperezgar / mark-feature-post.php
Last active Aug 29, 2015
Post featured in home with Wordpress
View mark-feature-post.php
//Código en el post type:
//Variable Meta para Mobiliario
add_action('admin_init', 'admin_init_ptype');
add_action('save_post', 'save_ptype');
function admin_init_mobiliario(){
add_meta_box("fichadele", "Variables Mobiliario", "meta_options_mobopt", "mobiliario-opticas", 'side', 'high');
}
function meta_options_mobopt(){
@davidperezgar
davidperezgar / favicon-wordpress.php
Created Dec 28, 2014
Favicon Code in Header.php for Wordpress Site
View favicon-wordpress.php
<link type="image/x-icon" href="<?php bloginfo('stylesheet_directory'); ?>/images/favicon.png" rel="icon" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
@davidperezgar
davidperezgar / wp-config-es.php
Created Dec 29, 2014
WP-Login ES for Local and Remote
View wp-config-es.php
<?php
if ($_SERVER['HTTP_HOST'] === "localhost") {
define('DB_NAME', '');
define('DB_USER', 'root');
define('DB_PASSWORD', 'root');
define('WP_HOME', 'http://localhost/');
define('WP_SITEURL', 'http://localhost/');
define('WP_DEBUG', false);
} else {
define('DB_NAME', '');
View register-attributes-menu.php
add_filter('woocommerce_attribute_show_in_nav_menus', 'wc_reg_for_menus', 1, 2);
function wc_reg_for_menus( $register, $name = '' ) {
if ( $name == 'pa_size' ) $register = true;
return $register;
}
View footer-script
View gist:c0d19e68e0fc2b9b9642
<?php
/*
Template Name: My Custom Page
*/
@davidperezgar
davidperezgar / htaccess
Last active Aug 29, 2015
Not allow execute PHP in WP-uploads
View htaccess
<FilesMatch "\.(php|php\.)(.+)(\w|\d)$">
Order Allow,Deny
Deny from all
</FilesMatch>
View gp-limit-choices-spots-left.php
<?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 );
You can’t perform that action at this time.