Skip to content

Instantly share code, notes, and snippets.

View duroe5698's full-sized avatar

Marc Duroe duroe5698

View GitHub Profile
@duroe5698
duroe5698 / basic-wordpress-wrapper-shortcode.php
Created March 22, 2018 20:11
Basic WordPress "Wrapper" Shortcode
<?php
//Basic Wrapper Shortcode
function basic_wrapper_sc( $atts, $content = null) {
return '<div class="basic-wrapper-sc">' . $content . '</div>';
}
add_shortcode('basic-wrapper-sc', 'basic_wrapper_sc');
?>
@duroe5698
duroe5698 / google-re-captcha-php-validation-check.php
Created February 3, 2017 15:22
Google re-Captcha PHP validation check
<?php
$secret = 'YOURSECRETKEY';
$response=$_POST["g-recaptcha-response"];
$verify=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret={$secret}&response={$response}");
$captcha_success=json_decode($verify);
?>
@duroe5698
duroe5698 / add-custom-menu-item-and-endpoint-to-woocommerce-my-account-page.php
Last active July 8, 2023 18:05
Add custom menu item and endpoint to WooCommerce my-account page
/* Add custom menu item and endpoint to WooCommerce My-Account page */
function my_custom_endpoints() {
add_rewrite_endpoint( 'refunds-returns', EP_ROOT | EP_PAGES );
}
add_action( 'init', 'my_custom_endpoints' );
function my_custom_query_vars( $vars ) {
$vars[] = 'refunds-returns';
@duroe5698
duroe5698 / htaccess redirect when moving to new domain
Created June 29, 2016 14:50
htaccess redirect when moving to new domain
<IFModule mod_rewrite.c>
RewriteEngine on
Options +FollowSymlinks
RewriteBase /
RewriteCond %{HTTP_HOST} ORIGINALDOMAIN\.com
RewriteRule ^(.*) http://NEWDOMAIN.com/$1 [L,R=301]
</IfModule>
@duroe5698
duroe5698 / add-html-to-wordpress-widget-titles.php
Created April 5, 2016 18:17
Add HTML to WordPress Widget Titles
<?php
//allow html in widget title
function md_change_widget_title($title)
{
//convert square brackets to angle brackets
$title = str_replace('[', '<', $title);
$title = str_replace(']', '>', $title);
//strip tags other than the allowed set
$title = strip_tags($title, '<a><blink><br><span>');
@duroe5698
duroe5698 / Keep Parent Nav Color Same as SubMenu When Active Genesis WordPress.css
Created January 1, 2016 19:11
Keep Parent Nav Color Same as Submenu When Active Genesis WordPress
.genesis-nav-menu li:hover > a {
background-color: #2673A0;
}
@duroe5698
duroe5698 / Add Page Templates To WordPress via Plugin.php
Created December 14, 2015 17:49
Add Page Templates To WordPress via Plugin
<?php
//* Add this code to your plugin and it will register all templates defined in array on line 66 to your theme.
class PageTemplater {
/**
* A Unique Identifier
*/
protected $plugin_slug;
@duroe5698
duroe5698 / tab-index.css
Last active December 2, 2015 18:14
Hover Content Tab Index
/*
Tab Index Styles
---------------------------------------------------------------------------------------------------- */
.tab-index-list {
margin-top: 0px;
}
.tab-index {
display: inline-block;
@duroe5698
duroe5698 / jquery.localScroll.min.js
Created December 2, 2015 16:40
Smooth Scrolling To In Page Links WordPress
/**
* Copyright (c) 2007-2015 Ariel Flesler - aflesler<a>gmail<d>com | http://flesler.blogspot.com
* Licensed under MIT
* @author Ariel Flesler
* @version 1.4.0
*/
;(function(a){if(typeof define==='function'&&define.amd){define(['jquery'],a)}else{a(jQuery)}}(function($){var g=location.href.replace(/#.*/,'');var h=$.localScroll=function(a){$('body').localScroll(a)};h.defaults={duration:1000,axis:'y',event:'click',stop:true,target:window};$.fn.localScroll=function(a){a=$.extend({},h.defaults,a);if(a.hash&&location.hash){if(a.target)window.scrollTo(0,0);scroll(0,location,a)}return a.lazy?this.on(a.event,'a,area',function(e){if(filter.call(this)){scroll(e,this,a)}}):this.find('a,area').filter(filter).bind(a.event,function(e){scroll(e,this,a)}).end().end();function filter(){return!!this.href&&!!this.hash&&this.href.replace(this.hash,'')===g&&(!a.filter||$(this).is(a.filter))}};h.hash=function(){};function scroll(e,a,b){var c=a.hash.slice(1),elem=document.getElementById(c)||document.getElementsByName(c)[0];if(