Skip to content

Instantly share code, notes, and snippets.

View fernandofuly's full-sized avatar

Fernando Fuly fernandofuly

  • Telefonica/VIVO
  • Curitiba, Brazil
View GitHub Profile
@fernandofuly
fernandofuly / Remove "Quick Edit" from Custom Post Types
Last active August 29, 2015 14:01
Remove "Quick Edit" from Custom Post Types
// Remove "Quick Edit" from Custom Post Types
function remove_quick_edit( $actions ) {
global $post;
if( $post->post_type == 'Custom_Post_Name_Here' ) {
unset($actions['inline hide-if-no-js']);
}
return $actions;
}
if (is_admin()) {
add_action('admin_menu', 'my_remove_sub_menus');
function remove_sub_menus() {
remove_submenu_page('edit.php', 'edit-tags.php?taxonomy=category');
remove_submenu_page('edit.php', 'edit-tags.php?taxonomy=post_tag');
}
@fernandofuly
fernandofuly / Back Historic with jQuery
Last active August 29, 2015 14:04
Back historic with jQuery.
$('a.goback').click(function() {
window.history.back();
return false;
});
@fernandofuly
fernandofuly / Two Sticky Loops - WordPress
Created July 24, 2014 14:37
Two Different Sticky Loops - WordPress
<?php $do_not_duplicate = array();
$my_query = new WP_Query(
array(
'posts_per_page' => 3,
'post__in' => get_option( 'sticky_posts' ),
'ignore_sticky_posts' => true
)
);
while ($my_query->have_posts()) : $my_query->the_post();
<?php $my_query = new WP_Query('page_id=ID-FOR-PAGE');
while ($my_query->have_posts()) : $my_query->the_post();
$do_not_duplicate = $post->ID;
?>
<?php the_content(); ?>
<?php endwhile; ?>
@fernandofuly
fernandofuly / Display All Your WordPress Categories in a Drop Down Menu
Created September 11, 2014 14:54
Display All Your WordPress Categories in a Drop Down Menu
<form action="<?php bloginfo('url'); ?>/" method="get">
<?php
$select = wp_dropdown_categories('show_option_none=Select Category&show_count=1&orderby=name&echo=0&selected=6');
$select = preg_replace("#<select([^>]*)>#", "<select$1 onchange='return this.form.submit()'>", $select);
echo $select;
?>
<noscript><input type="submit" value="View" /></noscript>
</form>
function SearchFilter($query) {
if ($query->is_search) {
$query->set('post_type', 'post');
}
return $query;
}
add_filter('pre_get_posts','SearchFilter');
@fernandofuly
fernandofuly / CSS: Inline-Block on IE
Created September 23, 2014 20:31
Fix the ie7 and inline-block css bug
// Original CSS:
.content .pager li {
display: inline-block;
}
// Fixed CSS:
.content .pager li {
display: inline-block;
function mv_browser_body_class($classes) {
global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone;
if($is_lynx) $classes[] = 'lynx';
elseif($is_gecko) $classes[] = 'gecko';
elseif($is_opera) $classes[] = 'opera';
elseif($is_NS4) $classes[] = 'ns4';
elseif($is_safari) $classes[] = 'safari';
elseif($is_chrome) $classes[] = 'chrome';
elseif($is_IE) {
$classes[] = 'ie';
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(