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 / SassMeister-input.scss
Last active July 15, 2016 13:47
Generated by SassMeister.com.
// ----
// Sass (v3.4.21)
// Compass (v1.0.3)
// ----
/* Parent selector and Nesting */
#demo {
&-child {margin: .5em;}
&child {margin: .5em;}
&.child {margin: .5em;}
@fernandofuly
fernandofuly / fix-modal-css
Created January 6, 2016 11:54
Fix modal pushes container to the left
html {
overflow: hidden;
height: 100%;
}
body {
overflow: auto;
height: 100%;
}
/* unset bs3 setting */
@fernandofuly
fernandofuly / sass-tips.scss
Created September 15, 2015 15:05
Sass tips
// Placeholder
%btn {
padding: 10px;
color: #fff;
cursor: pointer;
border: none;
shadow: none;
font-size: 14px;
width: 150px;
margin: 5px 0;
@fernandofuly
fernandofuly / change-label-menu.php
Created April 7, 2015 19:11
Rename Label "Posts" in Admin Menu
function change_post_menu_label() {
global $menu;
global $submenu;
$menu[5][0] = 'Artigos';
$submenu['edit.php'][5][0] = 'Artigos';
$submenu['edit.php'][10][0] = 'Adicionar Artigo';
$submenu['edit.php'][15][0] = 'Status'; // Change name for categories
$submenu['edit.php'][16][0] = 'Labels'; // Change name for tags
echo '';
}
@fernandofuly
fernandofuly / customize-theme-options.php
Last active August 29, 2015 14:16
Basic CSS for Theme Options - WordPress
/**
* Customize Theme Options
**/
add_action( 'admin_head', 'better_options' );
function better_options() {
echo '
<style>
.appearance_page_customizacao .wrap {
background-color: #fff;
@fernandofuly
fernandofuly / exclude-current-post.php
Created December 5, 2014 14:12
Exclude Current Post ID from loop in Sidebar - WPQuery
<?php
// This is it
'post__not_in' => array( $post->ID )
@fernandofuly
fernandofuly / remove-private-title.php
Last active August 29, 2015 14:08
Remove “private” and “protected” from the post title
<?php
function the_title_trim($title) {
$title = attribute_escape($title);
$findthese = array(
'#Protected:#',
'#Private:#'
);
$replacewith = array(
'', // What to replace "Protected:" with
'' // What to replace "Private:" with
@fernandofuly
fernandofuly / excerpt.php
Last active August 29, 2015 14:08
Detect If the "optional excerpt" is empty
<?php
if( $post->post_excerpt ) {
the_excerpt();
} else {
the_title();
}
?>
@fernandofuly
fernandofuly / limit-sticky-posts.php
Last active October 29, 2015 14:40
Limit Number of Sticky Posts to Show
<?php
$sticky = get_option( 'sticky_posts' );
/* Sort the newest one at the top */
rsort( $sticky );
/* Get the 2 newest stickies (change 2 for a different number) */
$sticky = array_slice( $sticky, 0, 2 );
/* Query Post */
<?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(