Skip to content

Instantly share code, notes, and snippets.

View jpcontrerasv's full-sized avatar
🏠
Working from home

Juan Pablo Contreras Valdés jpcontrerasv

🏠
Working from home
View GitHub Profile
@jpcontrerasv
jpcontrerasv / else if wordpress.php
Created November 4, 2016 14:53
else if wordpress
<? if ( is_singular('project') ) : ?>
<?php elseif( is_singular('news') ): ?>
<? else : ?>
<?php endif; ?>
@jpcontrerasv
jpcontrerasv / ACF If Else field.php
Created August 26, 2016 04:46
ACF If Else field
<?php if ( get_field( 'field_name' ) ): ?>
This is displayed when the field_name is TRUE or has a value.
<?php else: // field_name returned false ?>
This is displayed when the field is FALSE, NULL or the field does not exist.
<?php endif; // end of if field_name logic ?>
@jpcontrerasv
jpcontrerasv / numero incremento.php
Created August 3, 2016 15:07
Número Incremento
<?php
if ( have_posts() ) :
$slideNumber = 1;
while ( have_posts() ) : the_post(); ?>
<div id="slide">
<ul>
<li class="slide-<?php echo $slideNumber++; ?>">
<a href="#">stuff</a></li>
</ul>
</div>
@jpcontrerasv
jpcontrerasv / gravatar
Created May 4, 2016 18:29
Crear Gravatar
http://shibashake.com/wordpress-theme/wordpress-gravatars-use-your-own-default-avatar
$locale='es_ES';
@jpcontrerasv
jpcontrerasv / Condicional WPML.php
Created January 15, 2016 16:06
Condicional WPML
<?php if(ICL_LANGUAGE_CODE=='en'){ ?>
<?php } if(ICL_LANGUAGE_CODE=='es'){ ?>
<?php } ?>
<?php bloginfo('name'); ?>&nbsp;<?php if ( is_home() ) { ?><? } else { ?> / <?php
echo empty( $post->post_parent ) ? get_the_title( $post->ID ) : get_the_title( $post->post_parent );
?><? } ?>
p::first-letter {
font-weight: bold;
color: red;
float: left;
width: 0.7em;
font-size: 400%;
font-family: algerian, courier;
line-height: 80%;
}
@jpcontrerasv
jpcontrerasv / dropdown-responsive-menu.html
Created March 23, 2015 19:41
Dropdown responsive menu
http://codepen.io/micahgodbolt/pen/czwer
<?php if (preg_match('~MSIE|Internet Explorer~i', $_SERVER['HTTP_USER_AGENT']) || (strpos($_SERVER['HTTP_USER_AGENT'], 'Trident/7.0; rv:11.0') !== false)) { ?>
<?php } else { ?>
<? } ?>