Skip to content

Instantly share code, notes, and snippets.

@tigredanky
tigredanky / regex-url-3-digit-redirect.php
Last active June 17, 2021 12:58
Regex for three digit url redirection
//SOURCE URL
^/any/slug/([0-9]{3})
//TARGET URL
/and/new/slug/$1
@tigredanky
tigredanky / functions-button-appear-timer.php
Created June 4, 2021 22:44
WordPress Functions.php | Button Appears Via Timer
<?php
add_shortcode('lesson_button', function($attr) {
$timer = isset($attr['timer']) ? $attr['timer'] : 140;
ob_start();
?>
<script src="https://player.vimeo.com/api/player.js"></script>
<script>
var player;
@tigredanky
tigredanky / functions-add-body-class-template.php
Created June 4, 2021 19:24
WordPress Functions.php | Add Body Class By Page Template
<?
// BODY CLASS FOR NOLOGO PAGE TEMPLATE
add_filter( 'body_class','nologo_body_class' );
function nologo_body_class( $classes ) {
if ( is_page_template( array( 'page-nologo.php', 'page-empathology.php', 'page-resilience-reboot.php' ) ) ) {
$classes[] = 'nologo';
}
@tigredanky
tigredanky / functions-child-css-timestamp.php
Last active June 4, 2021 19:22
WordPress Functions.php | Child Theme CSS Versioning for Testing
<?
// Found Here: https://generatepress.com/forums/topic/child-theme-style-css-version-string/
function _fix_child_css_version( $src ) {
$parts = explode( '?', $src );
if ( stristr( $parts[0], 'your-child-theme/style.css' ) ) {
$child_ver = filemtime( get_stylesheet_directory() . '/style.css' );
return $parts[0] . '?v=' . $child_ver;
}
else {
return $src;
@tigredanky
tigredanky / functions-favicon-admin-client.php
Last active June 4, 2021 19:22
WordPress Functions.php | Favicon Frontend & Admin Option
<?php
// FAVICON ADDITION
function add_my_favicon() {
if ( ! is_admin() ) {
//$favicon_path = get_site_url() . '/img/favicon-client.png';
$favicon_path = get_site_url() . '/i/favicon-client';
} else {
//$favicon_path = get_site_url() . '/img/favicon-admin.png';
$favicon_path = get_site_url() . '/i/favicon-admin';