The progressive plan for customizing the WordPress Editor for clientx (sep 2020)

Victor Ramirez talks about the approach here: https://www.youtube.com/watch?v=3o66SvY9G1k&t=91s

The plan itself was posted on Twitter. It is a bit old, but it sounds like decent approach

Level 1

Read More

Blade Icons

Blade Icons

A package to easily make use of SVG icons in your Laravel Blade views. Originally “Blade SVG” by Adam Wathan.

Turn…

<!-- camera.svg -->
<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" class="w-6 h-6">
  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 9a2 2 0 012-2h.93a2 2 0 001.664-.89l.812-1.22A2 2 0 0110.07 4h3.86a2 2 0 011.664.89l.812 1.22A2 2 0 0018.07 7H19a2 2 0 012 2v9a2 2 0 01-2 2H5a2 2 0 01-2-2V9z"/>
  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 13a3 3 0 11-6 0 3 3 0 016 0z"/>
</svg>

Into…

<x-icon-camera class="w-6 h-6" />

Or into…

@svg('camera', 'w-6 h-6')

Search all 84,305 Blade Icons:

https://blade-ui-kit.com/blade-icons#search

But for a better overview you may want to go to the homepages of the icons set instead. For example:

https://heroicons.com/

Read More

How I regained concentration and focus (Gernot Starke 2022)

From distraction to concentration in a few simple steps

https://www.innoq.com/en/blog/wie-ich-meine-konzentration-wiederfand/

Below my excerpt of this article:

July 29, 2022

For years, I enthusiastically produced content: books, articles, blog posts, and talks – averaging a book and a half plus five articles per year. Since about 2020, my productivity has plummeted – leaving me totally frustrated. There were no external causes, even the pandemic didn’t affect me, thanks to a nice home office and online work options — so no excuses. To find a way out of the misery, I put my own working habits to the test – and diagnosed a massive loss of concentration. ​ ​

Read More

Roots Dev’s Favorite WordPress Plugins and Utilities

https://roots.io/favorite-wordpress-plugins-and-utilities/

I asked Brandon Nifong, Mike Spainhower, Craig, Evan Mattson, Nathan Knowler, and Matt Mirus for their recommendations on WordPress plugins and any relevant Composer packages they use on their sites. Here’s what our list of most frequently used WordPress plugins looks like!

Free WordPress plugins

  • Better Search Replace for performing a search/replace on the database $ composer require wpackagist-plugin/better-search-replace
  • Breadcrumb NavXT for breadcrumb trails $ composer require wpackagist-plugin/breadcrumb-navxt
  • Disable Comments for globally disabling comments on any post type $ composer require wpackagist-plugin/disable-comments
  • Duplicate Post for cloning posts from any post type $ composer require wpackagist-plugin/duplicate-post
  • Easy WP SMTP for configuring WordPress to send emails through any SMTP server $ composer require wpackagist-plugin/easy-wp-smtp
  • HTML Forms for straightforward and flexible forms in WordPress $ composer require wpackagist-plugin/html-forms
  • Imsanity for automatically resizing large image uploads $ composer require wpackagist-plugin/imsanity
  • Intervention for cleaning up and customizing the wp-admin $ composer require soberwp/intervention
  • Post Type Switcher for reassigning any post to a new post type $ composer require wpackagist-plugin/post-type-switcher
  • Query Monitor for WordPress dev tools $ composer require wpackagist-plugin/query-monitor
  • Restricted Site Access for enforcing user logins or whitelisting IPs for access $ composer require wpackagist-plugin/restricted-site-access
  • Safe Redirect Manager for managing redirects $ composer require wpackagist-plugin/safe-redirect-manager
  • Safe SVG for allowing SVG uploads $ composer require wpackagist-plugin/safe-svg
  • Simple Page Ordering for re-ordering any type of page or post with drag and drop $ composer require wpackagist-plugin/simple-page-ordering
  • Stream for logging activity on your WordPress install $ composer require wpackagist-plugin/stream
  • The SEO Framework for fast SEO with automated titles and descriptions $ composer require wpackagist-plugin/autodescription
  • WPBruiser for preventing spam comments and brute force attacks $ composer require wpackagist-plugin/goodbye-captcha
  • WP Stage Switcher for switching between different environments from the admin bar (by Roots) $ composer require roots/wp-stage-switcher
  • WP Term Order for re-ordering any term with drag and drop $ composer require wpackagist-plugin/wp-term-order
  • WP User Avatars for allowing users to upload & select their own avatars $ composer require wpackagist-plugin/wp-user-avatars
  • WP User Profiles for a different way to edit users $ composer require wpackagist-plugin/wp-user-profiles
  • WP-Optimize for automatically cleaning your WordPress database $ composer require wpackagist-plugin/wp-optimize

Paid WordPress plugins

Utilities/Composer packages

Remove jquery Migrate logging

function remove_jquery_migrate( $scripts ) {
	
	if ( ! is_admin() && isset( $scripts->registered['jquery'] ) ) {
			
		$script = $scripts->registered['jquery'];
		
		if ( $script->deps ) { 
			$script->deps = array_diff( $script->deps, array( 'jquery-migrate' ) );
		}
	}
}
add_action( 'wp_default_scripts', 'remove_jquery_migrate' );

WP REST API – sort by menu_order

Sage 10:

In filters.php add:

// /**
// * The filter is named rest_{post_type}_collection_params. So you need to hook a new filter for each
// * of the custom post types you need to sort.
// * @link https://www.timrosswebdevelopment.com/wordpress-rest-api-post-order/
// */

// This enables the orderby=menu_order for Posts
add_filter( 'rest_post_collection_params', __NAMESPACE__ . '\\filter_add_rest_orderby_params', 10, 1 );
// And this for a custom post type called 'faq'
add_filter( 'rest_faq_collection_params', __NAMESPACE__ . '\\filter_add_rest_orderby_params', 10, 1 );

// /**
// * Add menu_order to the list of permitted orderby values
// */
function filter_add_rest_orderby_params( $params ) {
  $params['orderby']['enum'][] = 'menu_order';
   return $params;
}

Now you can use SITEURL/wp-json/wp/v2/faq?orderby=menu_order

hamburgers by Jonathan Suh

https://jonsuh.com/hamburgers/

https://discourse.roots.io/t/how-to-using-hamburgers-package-in-sage/11543


mmirus (2018):

Install:

yarn add hamburgers

Import in main.scss:

@import "~hamburgers/_sass/hamburgers/hamburgers";

Add the markup:
Probably in your header.blade.php partial.

<button class="hamburger hamburger--vortex" type="button">
  <span class="hamburger-box">
    <span class="hamburger-inner"></span>
  </span>
</button>

In this case, I’m using the ‘vortex’ type.

Customize as desired in _variables.scss:
Here’s what I used for my current project, but see the different types and the list of SASS variables in the page linked to above.

/** Hamburger icon */
$hamburger-padding-x: 0;
$hamburger-padding-y: 0;
$hamburger-layer-width: 20px;
$hamburger-layer-height: 2px;
$hamburger-layer-spacing: 4px;
$hamburger-layer-color: $brand-primary;
$hamburger-types: (vortex);

Again, I’m using the ‘vortex’ type here.

Add JS to make it functional to common.js:

export default {
  init() {
    // JavaScript to be fired on all pages
    $(".hamburger").click(function() {
      $(this).toggleClass("is-active");
    });
  },
  finalize() {
    // JavaScript to be fired on all pages, after page specific JS is fired
  },
};

You would likely also be toggling the state of your menu in the same click handler.

That should be it.


toddsantoro (2022)

Might want to change the snippet in the guide to initiate the hamburger to:

  $('.hamburger').on( 'click', function() {
    $(this).toggleClass('is-active');
  });

so the deprecation warnings go away.


Or in AlpineJS you can do something like this:

<div class="flex justify-center items-center w-10 h-10 rounded-full border border-solid xl:hidden border-[#888]">
        
<button 
  :class="isOpen ? 'is-active' : ''" 
  class="hamburger hamburger--3dy" 
  type="button" 
  @@click="isOpen = !isOpen">
  <span class="hamburger-box">
    <span class="hamburger-inner"></span>
  </span>
</button>
</div>

Corset – Cascading binding sheets

Reactive UI without the complexity of SPA frameworks. Use any backend you like; bind to the HTML you already produced.

Get started

Documentation

Bring your HTML to life.

Corset binds JavaScript to HTML. It doesn’t matter how the HTML is produced and Corset doesn’t need to own your templating choice. Instead it uses a CSS-like syntax to enhance whatever you give it.

HTML

<div class="counter">
  <button
    type="button"
    class="increment">Increment</button>
  <button
    type="button"
    class="decrement"
    disabled>Decrement</button>

  <div
    class="result">
    Count: <strong class="count">0</strong>
  </div>
</div>

JavaScript with Corset

import sheet, { mount } from 'https://cdn.corset.dev/v1';

mount(document, class {
  count = 0;

  bind() {
    const { count } = this;

    return sheet`
      .counter {
        --count: ${count};
        --inc: ${() => this.count = count + 1};
        --dec: ${() => this.count = count - 1};
      }
      
      .count {
        text: var(--count);
      }
      
      .increment {
        event[click]: var(--inc);
      }
      
      .decrement {
        attr-toggle[disabled]: ${count === 0};
        event[click]: var(--dec);
      }
    `;
  }
});

CodePen 👉