Skip to content

Instantly share code, notes, and snippets.

Avatar
😀
Hello

John jemoreto

😀
Hello
View GitHub Profile
@jemoreto
jemoreto / yourls-custom-url-parameters.php
Last active Oct 25, 2020
YOURLS Custom URL Parameters - Manages long link exit URL parameters
View yourls-custom-url-parameters.php
<?php
/*
Plugin Name: WP Boss - YOURLS Custom URL Parameters
Plugin URI: https://www.wpboss.com.br/
Description: Manages long link exit URL parameters
Version: 1.0
Author: John (João Elton Moreto)
Author URI: https://www.wpboss.com.br/
This plugin is based on "Google Analytics" plugin, by Katz Web Services, Inc. Reference link: http://katz.co/yourls-analytics/
View Soliloquy WP remove admin notice license expired
// Put this on your theme's functions.php
add_action( 'init', 'q11_remove_soliloquy_license_stuff', 999 );
function q11_remove_soliloquy_license_stuff() {
// Do nothing if Soliloquy is not active.
if ( !class_exists('Soliloquy') && !is_admin() ) {
return;
}
if (is_admin()) {
@jemoreto
jemoreto / wpboss-file-rename-upload.php
Last active May 15, 2018
Este plugin renomeia e limpa nomes de arquivos de mídia do WordPress durante o upload
View wpboss-file-rename-upload.php
<?php
/**
* Plugin Name: WP Boss // Sanitizar nome de arquivo no upload
* Plugin URI: https://www.wpboss.com.br/dicas-truques/renomear-limpar-nomes-arquivos-midia-fazer-upload-wordpress/
* Description: Este plugin renomeia e limpa nomes de arquivos de mídia do WordPress durante o upload.
* Version: 1.0
* Author: João Elton Moreto <john@wpboss.com.br>
* Author URI: https://www.wpboss.com.br/
* License: GPL-2.0+
*/
@jemoreto
jemoreto / wp-404-redirect-valid-slug.php
Created Sep 1, 2017
WordPress redirect 404 with valid slug
View wp-404-redirect-valid-slug.php
function q11_redirect_uri_site_antigo() {
if ( is_404() ) {
$url = 'INSERT_YOUR_DOMAIN_HERE' . $_SERVER['REQUEST_URI'];
$end = end(explode('/', rtrim($url, '/')));
if ($end) {
if ( $post = get_page_by_path( $end, OBJECT, array('post', 'page'))) {
$id = $post->ID;
} else {
@jemoreto
jemoreto / post_id_body_class_wp_admin.txt
Last active Dec 3, 2015
Adds the current editing post's ID to body_class in WordPress admin
View post_id_body_class_wp_admin.txt
// Adds the current editing post's ID to body_class in WordPress admin
// Add this code in your theme's funtions.php
function post_id_to_body_admin($pid) {
$screen = get_current_screen();
if ( 'post' == $screen->base ) {
global $post;
$pid .= ' post-id-' . $post->ID;
return $pid;
}
}
@jemoreto
jemoreto / multiple-roles-per-user.php
Created May 15, 2015
Multiple roles per user WordPress plugin. Working when creating a new user and editing an user. Thanks to nikolov-tmw (https://goo.gl/Xv563d) and evankennedy (https://goo.gl/sh2sX6).
View multiple-roles-per-user.php
/**
* Plugin Name: Multiple Roles per User
* Description: Allows anyone who can edit users to set multiple roles per user. In a default WordPress environment that wouldn't have much of an effect, since the user would have the privileges of the top-privileged role that you assign to him. But if you have custom roles with custom privileges, this might be helpful.
* Version: 1
* Author: nikolov.tmw
* Author URI: http://paiyakdev.com/
* License: GPL2
*/
/*
Copyright 2013 Nikola Nikolov (email: nikolov.tmw@gmail.com)
You can’t perform that action at this time.