Skip to content

Instantly share code, notes, and snippets.

@rfvcorreia
rfvcorreia / new_meta_query.php
Created March 31, 2015 10:26
WordPress New Meta Query
$q = new WP_Query( array(
'meta_query' => array(
'relation' => 'AND',
'state_clause' => array(
'key' => 'state',
'value' => 'Wisconsin',
),
'city_clause' => array(
'key' => 'city',
'compare' => 'EXISTS',
@rfvcorreia
rfvcorreia / site.js
Created January 2, 2014 12:07
Toggle Element without animating width/height
$('#top-menu > ul').animate({height: "toggle", opacity: "toggle"});
@rfvcorreia
rfvcorreia / functions.php
Created November 15, 2013 16:04
Query Post by Week, Greater than current week. Add to WP_Query Args.
<?php
$args = array('date_query' => array(
array(
'week' => date('W'),
'compare' => '>='
),
)
);
?>
@rfvcorreia
rfvcorreia / functions.php
Created November 15, 2013 12:19
Add Taxonomy Filter For Custom Post Type
<?php
function salas_add_taxonomy_filters() {
global $typenow;
// an array of all the taxonomyies you want to display. Use the taxonomy name or slug
$taxonomies = array('salas');
// must set this to the post type you want the filter(s) displayed on
if( $typenow == 'evento' || $typenow == 'noticia' || $typenow == 'ementa' || $typenow == 'lembrete' || $typenow == 'aluno' || $typenow == 'paginas_privadas'){
@rfvcorreia
rfvcorreia / functions.php
Created October 7, 2013 11:49
Fix CPT Menu highlight
//Fix CPT menu highlight
add_filter( 'nav_menu_css_class', 'namespace_menu_classes', 10, 2 );
function namespace_menu_classes( $classes , $item ){
$Cpost = 'portfolio'; //Define CPT name
$CpostMenu = get_bloginfo('url').'/'.$Cpost.'/'; //Define CPT Menu URL
if ( get_post_type() == $Cpost || is_archive( $Cpost ) ) {
// remove that unwanted classes if it's found
@rfvcorreia
rfvcorreia / functions.php
Created September 26, 2013 13:42
Get Sticky Posts, if not enough get latest posts
<?php
$sticky = get_option( 'sticky_posts' );
$total = 6;
$featured_args = array(
'posts_per_page' => $total,
'post__in' => $sticky,
'post_status' => 'publish',
'no_found_rows' => true
@rfvcorreia
rfvcorreia / functions.php
Created August 16, 2013 09:56
Remove Shortcodes from excerpt
function custom_excerpt($text = '') {
$raw_excerpt = $text;
if ( '' == $text ) {
$text = get_the_content('');
$text = strip_shortcodes( $text );
$excerpt_length = apply_filters('excerpt_length', 50);
$excerpt_more = apply_filters('excerpt_more', ' ' . '...');
$text = wp_trim_words( $text, $excerpt_length, $excerpt_more );
}
return apply_filters('wp_trim_excerpt', $text, $raw_excerpt);
@rfvcorreia
rfvcorreia / style.css
Created August 6, 2013 15:30
Opacity Crossbrowser
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; filter: alpha(opacity=70); -moz-opacity: 0.7; -khtml-opacity: 0.7; opacity: 0.7;
@rfvcorreia
rfvcorreia / style.css
Created August 6, 2013 13:20
Cover Background IE9+
background: url(../img/bg.jpg) top center no-repeat fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/bg.jpg', sizingMethod='scale');
-ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/bg.jpg', sizingMethod='scale')";
@rfvcorreia
rfvcorreia / style.css
Created August 6, 2013 13:20
CSS Cricle
-webkit-border-radius: 50%; -moz-border-radius: 50%; border-radius: 50%;