Skip to content

Instantly share code, notes, and snippets.

<?php
//Original
function zeo_final_title(){
// Use object to avoid namespace collisions
$zeo_rewrite_title = new zeo_rewrite_title();
// We want to act when the page is 99% complete
add_action('wp_footer', array(&$zeo_rewrite_title, 'wpzeo_footer'));
<?php
/*
Plugin Name: Nextend Social Login - Username length
*/
add_filter('nsl_validate_username', function ($isValid, $username, $errors) {
if (strlen($username) < 6) {
$errors->add('invalid_username', '<strong>' . __('ERROR') . '</strong>:' . __('Sorry, username must contain at least 6 characters.'));
$isValid = false;
}
<div><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1920 120" preserveAspectRatio="none"><br />
<g class="n2-ss-divider-start">
<path fill="RGBA(255,255,255,1)" opacity="0.25" d="M1920,0 0,120 0,0z" duration="1" delay="0" data-original="M1920,0 0,0 0,0z"></path>
<path fill="RGBA(255,255,255,1)" opacity="0.5" d="M1920,0 0,80 0,0z" duration="1" delay="0.2" data-original="M1920,0 0,0 0,0z"></path>
<path fill="RGBA(255,255,255,1)" d="M1920,0 0,40 0,0z" duration="1" delay="0.4" data-original="M1920,0 0,0 0,0z"></path>
</g><br />
<g class="n2-ss-divider-end">
<path fill="RGBA(255,255,255,1)" opacity="0.25" d="M1920,0 0,120 0,0z"></path>
<path fill="RGBA(255,255,255,1)" opacity="0.5" d="M1920,0 0,80 0,0z"></path>
<path fill="RGBA(255,255,255,1)" d="M1920,0 0,40 0,0z"></path>
<?php
/*
Plugin Name: Test
*/
function test() {
return '<div><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1920 120" preserveAspectRatio="none">
<g class="n2-ss-divider-start">
<path fill="RGBA(255,255,255,1)" opacity="0.25" d="M1920,0 0,120 0,0z" duration="1" delay="0" data-original="M1920,0 0,0 0,0z"></path>
<path fill="RGBA(255,255,255,1)" opacity="0.5" d="M1920,0 0,80 0,0z" duration="1" delay="0.2" data-original="M1920,0 0,0 0,0z"></path>
@nextend
nextend / trackerdata.php
Created March 7, 2018 06:38
Nextend Social Login - TrackerData
<?php
add_action('nsl_register_new_user', function ($user_id) {
if (NextendSocialLogin::getTrackerData() == 'editor') {
$user = new WP_User($user_id);
$user->set_role('editor');
}
});
@nextend
nextend / nsl-usage.php
Created February 15, 2018 09:47
Nextend Social Login - How to display buttons in themes or custom login forms
<?php
if(class_exists('NextendSocialLogin', false)){
NextendSocialLogin::renderButtonsWithContainer();
}
Hi, there is not such ready-to-use feature in Smart Slider, but you can do what you need.
You need to separate it into two task:
Task #1: On page load, scroll the browser to the slider with id 31:
<script type="text/javascript">
jQuery(window).on('ready', function() {
jQuery('html, body').scrollTop($('#n2-ss-31').offset().top);
});
</script>
@nextend
nextend / PHP - Clear and close all non-lethal output buffers ob_end_clean_all
Last active October 19, 2017 07:02
Before you want to send files or structured data over and AJAX call from PHP you might need to clean all output buffers (ob_start(...)) to be able to trash the junk in the buffers. It especially can happen in CMS like Joomla, WordPress etc.. when other plugin does strange things.
<?php
function ob_end_clean_all() {
$handlers = ob_list_handlers();
while (count($handlers) > 0 && $handlers[count($handlers) - 1] != 'ob_gzhandler' && $handlers[count($handlers) - 1] != 'zlib output compression') {
ob_end_clean();
$handlers = ob_list_handlers();
}
}
@nextend
nextend / isBefore.js
Created May 15, 2017 14:12 — forked from xilin/isBefore.js
Compare DOM tree order of elements
// http://stackoverflow.com/questions/3860351/relative-position-in-dom-of-elements-in-jquery
// What this does is .add() the additional element (or selector)
// (which jQuery keeps in document order) and then checks if it's the second of the two.
(function($) {
$.fn.isBefore = function(elem) {
if(typeof(elem) == "string") elem = $(elem);
return this.add(elem).index(elem) > 0;
}
})(jQuery)
@nextend
nextend / gist:7986647
Last active December 31, 2015 12:29 — forked from alexindigo/gist:1871785
Internet explorer 11 support added
// {{{ win-safari hacks, scratch this,
// let's just expose platform/browser to css
(function()
{
var uaMatch = '', prefix = '';
if (navigator.userAgent.match(/Windows/))
{
$('html').addClass('x-win');
}