Skip to content

Instantly share code, notes, and snippets.

View joecue's full-sized avatar
🎯
Focusing

Joe Querin joecue

🎯
Focusing
View GitHub Profile
@adrienne
adrienne / mullenweg-wpe.md
Last active April 16, 2025 15:22
The Mullenweg/WPE Thing
@myogeshchavan97
myogeshchavan97 / trap_focus.js
Last active November 26, 2022 08:46
Code for trapping focus inside modal
// add all the elements inside modal which you want to make focusable
const focusableElements =
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
const modal = document.querySelector('#exampleModal'); // select the modal by it's id
const firstFocusableElement = modal.querySelectorAll(focusableElements)[0]; // get first element to be focused inside modal
const focusableContent = modal.querySelectorAll(focusableElements);
const lastFocusableElement = focusableContent[focusableContent.length - 1]; // get last element to be focused inside modal
@bmaupin
bmaupin / free-database-hosting.md
Last active April 20, 2025 14:51
Free database hosting
@Jany-M
Jany-M / manage_paragraphs.php
Last active November 26, 2019 12:10
[WP][PHP] Split first paragraph from main content, display it elsewhere
<?php
// Grab the first paragraph, show it where you need it, then take the rest of the content and remove the first paragraph and show it elsewhere
// The script uses WordPress functions/content but can be used in any PHP script, just replace the WP functions
// First Paragraph
global $post;
$p1 = wpautop( $post->post_content );
$p1 = substr( $p1, 0, strpos( $p1, '</p>' ) + 4 );
//$p1 = strip_tags($p1, '<a><strong><em><h3><h2><i>'); // in case you need to remove some tags, add the ones you want to KEEP here
@kierzniak
kierzniak / functions.php
Created January 17, 2018 21:55
Search across all network blogs in elasticpress
<?php
/**
* Search across all network blogs with elasticpress
*
* @param $scope string Search scope
*
* @return string
*/
function motivast_ep_search_scope( $scope ) {
@holmberd
holmberd / php-pools.md
Last active April 19, 2025 05:22
Adjusting child processes for PHP-FPM (Nginx)

Adjusting child processes for PHP-FPM (Nginx)

When setting these options consider the following:

  • How long is your average request?
  • What is the maximum number of simultaneous visitors the site(s) get?
  • How much memory on average does each child process consume?

Determine if the max_children limit has been reached.

  • sudo grep max_children /var/log/php?.?-fpm.log.1 /var/log/php?.?-fpm.log
@sohelrana820
sohelrana820 / create_and_download_zip.php
Last active October 15, 2024 11:37
Create and download ZIP file in PHP
<?php
/**
* @author: Sohel Rana <[email protected]>
* @author URI: http://sohelrana.me
* @description: Create zip file and download in PHP
*/
function createZipAndDownload($files, $filesPath, $zipFileName)
{
// Create instance of ZipArchive. and open the zip folder.
@carrieforde
carrieforde / brackets-extensions.md
Last active May 10, 2017 19:10
A list of Brackets Extensions I Love
var project = 'slilccc', // Project name, used for build zip.
scssfolder = './wp-content/themes/' + project + '/SCSS',
workingdir = './wp-content/themes/' + project + '/',
cssdir = './wp-content/themes/' + project + '/css/',
buildir = './wp-content/themes/' + project + '_build/',
url = 'lccc.dev', // Local Development URL for BrowserSync. Change as-needed.
gulp = require('gulp'),
browserSync = require('browser-sync'), // Asynchronous browser loading on .scss file changes
reload = browserSync.reload,
autoprefixer = require('gulp-autoprefixer'), // Autoprefixing magic
WORDPRESS 201 OUTLINE
TEMPLATE HIERARCHY
• https://developer.wordpress.org/themes/basics/template-hierarchy/
THE LOOP
• https://codex.wordpress.org/The_Loop
• Resetting the Loop
• Multiple Loops on one page
HOOKS, ACTIONS, FILTERS