Skip to content

Instantly share code, notes, and snippets.

Sybre Waaijer sybrew

Block or report user

Report or block sybrew

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sybrew
sybrew / disable-rich-pins.php
Created Aug 13, 2019
Disable Pinterest Rich Pins for your WordPress site.
View disable-rich-pins.php
<?php
/**
* Plugin Name: Disable Pinterest rich pins.
* Description: This plugin adds a meta tag to your site header that tells Pinterest to disable rich pins for your WordPress site.
* Version: 1.0.0
* Author: Sybre Waaijer
* Author URI: https://theseoframework.com/
* License: GPLv3
*/
@sybrew
sybrew / title-branding.php
Created Jun 20, 2019
Edit TSF title branding
View title-branding.php
<?php
// Don't include the PHP tag in existing files.
// Requester: https://wordpress.org/support/topic/filter-to-remove-blogname-from-all-posts-or-other-post-type/
// Where do I place filters? See: https://tsf.fyi/docs/filters#where
/**
* Adjust The SEO Framework title branding.
*
View my-acf-focus-fields.php
<?php
// Ref: https://github.com/sybrew/The-SEO-Framework-Extension-Manager/blob/2d70d5a141491209340b72a8cefeb574dd00b538/extensions/essentials/focus/trunk/inc/classes/admin.class.php#L99-L128
/**
* Adds my custom fields to the Focus parser.
*
* @param array $elements
* @return array
*/
@sybrew
sybrew / tsf-title-date-support.php
Last active Mar 23, 2019
Adds date support for The SEO Framework custom titles
View tsf-title-date-support.php
<?php
// DO NOT USE THIS! It's condoned by Google.
// Usage: Add %%year%%, %%month%%, and/or %%day%% to custom meta titles in the SEO framework,
// and magically see them transform into their respective values.
add_filter( 'the_seo_framework_title_from_custom_field', function( $title, $args ) {
$params = [
@sybrew
sybrew / disable-tsf-seo-on-wpforo.php
Last active Sep 17, 2018
Disables The SEO Framework's SEO on wpForo pages.
View disable-tsf-seo-on-wpforo.php
<?php
// Don't include the PHP tag.
add_action( 'after_setup_theme', function() {
remove_action( 'init', 'The_SEO_Framework\\_wpforo_fix_page' );
add_action( 'the_seo_framework_init', function() {
if ( ! function_exists( 'wpforo_feature' ) || ! function_exists( 'is_wpforo_page' ) )
return;
@sybrew
sybrew / disable-tsf-on-request.php
Created Apr 16, 2018
Disable TSF when request URL starts with any of the exclusions.
View disable-tsf-on-request.php
<?php
//* Don't include the PHP tag.
add_action( 'after_setup_theme', function() {
$exclusions = array(
'/sample-page',
'/forums',
'/replies',
);
@sybrew
sybrew / disable-tsf-on-shortcode.php
Last active Sep 16, 2018
Work with TSF v3.0.6 or lower. Disable TSF when shortcodes are found in content.
View disable-tsf-on-shortcode.php
<?php
//* Don't include the PHP tag.
add_action( 'the_seo_framework_init', function() {
//! Set shortcodes here.
function get_tsf_excluded_shortcodes() {
return array(
'my-first-shortcode',
'my-first-shortcode',
@sybrew
sybrew / ifthisthenthatand.php
Created Mar 13, 2018
A readable if this-then-that-and-else-this-then-that-and... function wrapper.
View ifthisthenthatand.php
<?php
function if_( $value ) {
return new class( (bool) $value ) {
public $run, $and;
public $cb = [];
function __construct( $run ) { $this->run = $run; }
function __destruct() {
foreach ( $this->cb as $cb ) {
$cb ? $cb() : null;
@sybrew
sybrew / tsf-test-relative-fontcolor.php
Last active Aug 20, 2018
The testing script used to find issues with the new color calcuation in TSF. Double-click the page to load the next sequence.
View tsf-test-relative-fontcolor.php
<!DOCTYPE html>
<html>
<head>
<style>
div {
padding: 12px 0;
font-weight: 600;
font-size: 14px;
vertical-align: middle;
display: inline-block;
@sybrew
sybrew / remove-editor-requirement.php
Created Feb 9, 2018
Remove editor support requirement in TSF
View remove-editor-requirement.php
<?php
//! Don't include the php tag.
add_filter( 'the_seo_framework_custom_post_type_support', function( $support ) {
return array_diff( $support, array( 'editor' ) );
} );
You can’t perform that action at this time.