Skip to content

Instantly share code, notes, and snippets.

View nandomoreirame's full-sized avatar
🎧
Working

Fernando Moreira nandomoreirame

🎧
Working
View GitHub Profile
@nandomoreirame
nandomoreirame / custom_tinymce_remove_root_block_tag.php
Created September 2, 2018 00:31
WordPress remove root block tag
<?php
function custom_tinymce_remove_root_block_tag( $init ) {
$init['forced_root_block'] = false;
return $init;
}
add_filter( 'tiny_mce_before_init', 'custom_tinymce_remove_root_block_tag' );
<?php
function get_custom_menu( $atts )
{
switch ($atts['menu']) {
case 'primary':
$atts['menu'] = 'primary-menu';
break;
case 'secondary':
$atts['menu'] = 'secondary-menu';

Ideias de aplicativos by github.com/teles/awesome-ideas

  • Sistema de grid para front end personalizável;
  • Mixin de sass para background em faixas
  • Site para publicação de vagas para desenvolvedores front end
  • Site para perguntas e respostas sobre front end
  • Site para blogueiros que procuram blogs para escrever guest posts
  • Site gerador de schema.org para blogs
  • Template jekyll com page speed 100%
  • Página de admin para jekyll
@nandomoreirame
nandomoreirame / wp-maintenance-mode.php
Last active July 16, 2018 02:42
WP Quick maintenance mode
<?php
function cwc_maintenance_mode() {
if ( !current_user_can( 'edit_themes' ) || !is_user_logged_in() ) {
wp_die('Maintenance, please come back soon.');
}
}
add_action('get_header', 'cwc_maintenance_mode');
@nandomoreirame
nandomoreirame / wp-showAdminMessages.php
Last active July 16, 2018 02:42
Show an urgent message in the WordPress admin area
<?php
function showMessage($message, $errormsg = false){
if ($errormsg) {
echo '<div id="message" class="error">';
} else {
echo '<div id="message" class="updated fade">';
}
echo "<p><strong>$message</strong></p></div>";
@nandomoreirame
nandomoreirame / wp-themeNoMoreJumping.php
Last active July 16, 2018 02:43
WP Remove the “read more” jump
<?php
function themeNoMoreJumping($post) {
return '<a href="'.get_permalink($post->ID).'" class="read-more">'.'Continue Reading'.'</a>';
}
add_filter('excerpt_more', 'themeNoMoreJumping');
@nandomoreirame
nandomoreirame / wp-user-contactmethods.php
Last active July 16, 2018 02:44
WP - Add extra contact methods to user profiles
<?php
function themeUserContactmethods($user_contactmethods){
$user_contactmethods['twitter'] = 'Twitter Username';
$user_contactmethods['facebook'] = 'Facebook Username';
return $user_contactmethods;
}
add_filter('user_contactmethods', 'themeUserContactmethods');
@nandomoreirame
nandomoreirame / wp-linkAutoblank.php
Last active July 16, 2018 02:44
WP - Add target=”blank” to all links in the content
<?php
function linkAutoblank($text) {
$return = str_replace('<a', '<a target="_blank"', $text);
return $return;
}
add_filter('the_content', 'linkAutoblank');
@nandomoreirame
nandomoreirame / wp-image-compression.php
Created July 16, 2018 02:32
Prevent automatic image compression
<?php
add_filter('jpeg_quality', function($arg){return 100;});
<?php
$_theme = wp_get_theme();
$_themeName = $_theme->get('Name');
$_themeThemeURI = $_theme->get('ThemeURI');
$_themeDescription = $_theme->get('Description');
$_themeAuthor = $_theme->get('Author');
$_themeAuthorURI = $_theme->get('AuthorURI');
$_themeVersion = $_theme->get('Version');
$_themeVersion = $_theme->get('Version');