Skip to content

Instantly share code, notes, and snippets.

View robwent's full-sized avatar
💭
Doing 'stuff'

Robert Went robwent

💭
Doing 'stuff'
View GitHub Profile
<?php
/**
* Change min password strength.
*
* @author James Kemp (Iconic)
* @link http://iconicwp.com/decrease-strength-required-woocommerce-passwords/
* @param int $strength
* @return int
*/
function myclass_min_password_strength( $strength ) {
<wpml-config>
<admin-texts>
<key name="wp_2fa_email_settings">
<key name="enforced_email_subject"/>
<key name="enforced_email_body"/>
<key name="login_code_email_subject"/>
<key name="login_code_email_body"/>
<key name="user_account_locked_email_subject"/>
<key name="user_account_locked_email_body"/>
<key name="user_account_unlocked_email_subject"/>
@robwent
robwent / yoast-schema.php
Created April 24, 2019 21:28
Extends Yoast schema to add event data
<?php
include ("classes/Schema_Event.php");
add_filter( 'wpseo_schema_graph_pieces', 'PREFIX_add_graph_pieces', 11, 2 );
/**
* Adds Schema pieces to our output.
*
* @param array $pieces Graph pieces to output.
@robwent
robwent / Schema_Event.php
Last active April 23, 2023 19:14
Extends Yoast schema data to add events
<?php
use \Yoast\WP\SEO\Generators\Schema\Abstract_Schema_Piece;
class Schema_Event extends Abstract_Schema_Piece {
/**
* Determines whether or not a piece should be added to the graph.
*
* @return bool
@robwent
robwent / functions.php
Created April 17, 2019 19:16
Remove Yoast HTML Comments “This site is optimized with the Yoast WordPress SEO plugin” with Yoast v11
//Remove Yoast HTML Comments
//https://gist.github.com/robwent/f36e97fdd648a40775379a86bd97b332
function go_yoast() {
if (defined('WPSEO_VERSION')){
add_action('get_header',function (){ ob_start(function ($o){
return preg_replace('/\n?<.*?Yoast SEO plugin.*?>/mi','',$o); }); });
add_action('wp_head',function (){ ob_end_flush(); }, 999);
}
}
@robwent
robwent / add-joomla-article-layout-as-class-to-body.php
Last active March 30, 2019 17:16
Adds Joomla article alternative layout information as a class to the body tag. Use in your templates index.php file.
<?php
$app = JFactory::getApplication();
$view = $app->input->getCmd( 'view', '' );
$body_class = '';
if ( $view === 'article' ) {
$article = JTable::getInstance( "content" );
@robwent
robwent / check-upload-filename.php
Created March 17, 2019 16:29
Stops WordPress uploading images if the filename contains certain words.
<?php
/*
Plugin Name: Check Upload Filename
Plugin URI: https://www.robertwent.com/
Description: Prevents image uploads by filename
Version: 1.0
Author: Robert Went
*/
add_filter('wp_handle_upload_prefilter', 'check_for_lazy_people_uploads' );
@robwent
robwent / isotope-filter-no-layout-hash.js
Created March 13, 2019 14:24
Filters list of items from select using url hash and no layout
jQuery(document).ready(function ($) {
Isotope.Item.prototype._create = function () {
// assign id, used for original-order sorting
this.id = this.layout.itemGUID++;
// transition objects
this._transn = {
ingProperties: {},
clean: {},
onEnd: {}
@robwent
robwent / .htaccess
Created March 7, 2019 21:06
Redirect a URL that has a query string
# Redirects /index.php?option=com_content&task=view&id=59&Itemid=69
RewriteCond %{QUERY_STRING} ^option=com_content&task=view&id=59&Itemid=69$
RewriteRule ^index\.php?$ https://domain.com/page? [R=301,L]
@robwent
robwent / ispconfig-proxy.conf
Created January 19, 2019 20:31
Proxy ISPConfig secure domain to the hosting panel port.
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
SSLProxyEngine On
ProxyRequests On
ProxyPreserveHost On
ProxyPass /stats !
ProxyPass / https://127.0.0.1:8080/