Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@CodeCurosity
CodeCurosity / wp-redirect.php
Created October 23, 2019 09:54 — forked from wpscholar/wp-redirect.php
WordPress function for redirecting users on login based on user role
<?php
/**
* WordPress function for redirecting users on login based on user role
*/
function my_login_redirect( $url, $request, $user ){
if( $user && is_object( $user ) && is_a( $user, 'WP_User' ) ) {
if( $user->has_cap( 'administrator' ) ) {
$url = admin_url();
} else {
@CodeCurosity
CodeCurosity / code.php
Created June 25, 2019 10:38
Add a custom control to an existing Elementor widget
add_action( 'elementor/element/button/section_style/after_section_start', 'custom_button_field', 10, 2 );
/**
* Adding button fields
* @param \Elementor\Widget_Base $button
* @param array $args
*/
function custom_button_field( $button, $args ) {
$button->add_control( 'custom_button_type',
[
'label' => __( 'Button Type', 'elementor' ),
@CodeCurosity
CodeCurosity / multi-step-form.html
Last active January 11, 2019 21:21 — forked from raymond1988/multi-step-form.html
This html file is a demo of how to implement a multi-step registration form using html, bootstrap, css, jquery and parsley.js
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="Multi step/part form designed using bootstrap 4 for responsive and mobile first. This form also includes parseley validation."
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/open-iconic/1.1.1/font/css/open-iconic-bootstrap.min.css">
@CodeCurosity
CodeCurosity / iweb-logout-url-shortcode.php
Created December 7, 2018 09:55 — forked from mustardBees/iweb-logout-url-shortcode.php
Allows you to place a logout link within the WordPress editor.
/**
* Return logout URL and redirect to homepage
*
* Allows you to place a logout link within the WordPress editor. In visual
* view set the link to [logout-url], in text view, use
* <a href="[logout-url]">logout</a>.
*
* @author Phil Wylie
* @link http://goo.gl/025f5
*/