Skip to content

Instantly share code, notes, and snippets.

View element-api.php
<?php
use craft\elements\Entry;
use craft\helpers\UrlHelper;
return [
'endpoints' => [
'news.json' => function() {
return [
'elementType' => Entry::class,
'criteria' => ['section' => 'news'],
View format.js
<script>
// load a language
numeral.language('fr', {
delimiters: {
thousands: ' ',
decimal: ','
},
abbreviations: {
thousand: 'k',
million: 'm',
@CodeCurosity
CodeCurosity / wp-redirect.php
Created Oct 23, 2019 — forked from wpscholar/wp-redirect.php
WordPress function for redirecting users on login based on user role
View wp-redirect.php
<?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 Jun 25, 2019 — forked from Basilakis/code.php
Add a custom control to an existing Elementor widget
View code.php
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 Jan 11, 2019 — 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
View multi-step-form.html
<!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 Dec 7, 2018 — forked from mustardBees/iweb-logout-url-shortcode.php
Allows you to place a logout link within the WordPress editor.
View iweb-logout-url-shortcode.php
/**
* 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
*/