Skip to content

Instantly share code, notes, and snippets.

@GrindPress
GrindPress / gulpfile.js
Created February 21, 2023 06:16 — forked from bhdd/gulpfile.js
Updated Sage 8.6.0 build files
// ## Globals
var argv = require('minimist')(process.argv.slice(2));
var autoprefixer = require('gulp-autoprefixer');
var browserSync = require('browser-sync').create();
var changed = require('gulp-changed');
var concat = require('gulp-concat');
var flatten = require('gulp-flatten');
var gulp = require('gulp');
var gulpif = require('gulp-if');
var imagemin = require('gulp-imagemin');
@GrindPress
GrindPress / wp-admin-bar-tweaks.php
Created January 11, 2023 07:44 — forked from bahiirwa/wp-admin-bar-tweaks.php
wp-admin-bar-tweaks
Disable the WordPress Admin Bar for all Users and Visitors
Turn off the toolbar with one simple line.
view plain
/*
* Disable the WordPress Admin Bar for all Users and Visitors
*/
remove_action( 'init', '_wp_admin_bar_init' );
^ top
Enable the WordPress Admin Bar for admins only
@GrindPress
GrindPress / load-posts.js
Created January 4, 2023 00:27 — forked from bebaps/load-posts.js
Load posts into a page using the WP REST API
// This function uses AJAX to run a query.
// It assumes that there are no posts on the page, and they will be loaded by the user on demand.
// // There are no animations added here. For a smoother experience, it is a good idea to add animations to the button (ex. a loading icon during the request), or making the new posts animate in (ex, using Animate.css to fade them into the page)
$(function() {
// Grab the load button, since I only want to run the code if the button is on the page
var ajaxButton = $('#ajax-button');
if (ajaxButton) {
// The AJAX request
var getPosts = function() {
@GrindPress
GrindPress / load-more.js
Created January 4, 2023 00:26 — forked from bebaps/load-more.js
AJAX load more button using the WP REST API
// This function implements a "Load More" button.
// It assumes that there is already a matching query that has executed on the page, so this AJAX call is just a continuation of that query to grab additional posts.
// There are no animations added here. For a smoother experience, it is a good idea to add animations to the button (ex. a loading icon during the request), or making the new posts animate in (ex, using Animate.css to fade them into the page)
$(function() {
// Grab the load more button, since I only want to run the code if the button is on the page
var loadMoreButton = $('#load-more');
if (loadMoreButton) {
// Because there are already posts on the page, we need to manually tell this query what page of results to grab so that is doesn't load duplicate posts
var loadPosts = function(page) {
@GrindPress
GrindPress / functions-login.php
Created November 16, 2021 06:38 — forked from eteubert/functions-login.php
WordPress: Activation Email Customization
<?php
function change_welcome_mail_loginlink( $welcome_email, $user_id, $password, $meta ) {
$welcome_email = str_replace( 'LOGINLINK', 'http://www.mysite.com/my/custom/login/url', $welcome_email );
return $welcome_email;
}
add_filter( 'update_welcome_user_email', 'change_welcome_mail_loginlink', 10, 4 );
@GrindPress
GrindPress / wordpress_post_query_result_count.php
Created October 20, 2021 22:34 — forked from raazon/wordpress_post_query_result_count.php
WooCommerce result count / Post result count
<?php
/**
* WorpPress post query result
* @since 1.0.0
* @author Razon Komar Pal
* @return string - like: Showing 1–12 Of 29 Results
*/
if (get_query_var('paged')) {
@GrindPress
GrindPress / custom-post-type-ajax-pagination.php
Created October 10, 2021 22:34 — forked from raazon/custom-post-type-ajax-pagination.php
Wordpress custom post type ajax pagination
<?php
/*
* Custom Post Pagination
* @since 1.0.0
* return
*/
if (!function_exists('ic_custom_posts_pagination')) :
function ic_custom_posts_pagination($the_query=NULL, $paged=1){
global $wp_query;
<?php
WP_CLI::add_command( 'podcast', 'JS_Podcast_Import' );
/**
* Wired Core CLI Functions
*/
class JS_Podcast_Import extends WP_CLI_Command {
@GrindPress
GrindPress / import_podcasts.php
Created March 29, 2021 17:30 — forked from whyisjake/import_podcasts.php
WP-CLI script to import posts from an RSS feed into WordPress. Meant to map to existing posts, and if they don't exist, create new ones.
<?php
WP_CLI::add_command( 'podcast', 'Podcast_Importer' );
/**
* Podcast Importer
*/
class Podcast_Importer extends WP_CLI_Command {
@GrindPress
GrindPress / sunrise.php
Created March 29, 2021 07:21 — forked from badfeather/sunrise.php
Allow nested folder paths in WordPress Multisite with subdirectories
<?php
/**
* Allow nested folder paths in WordPress Multisite with subdirectories
* Updated from http://maisonbisson.com/post/14052/wordpress-hacks-nested-paths-for-wpmu-blogs/ to account for latest WordPress code
* .htaccess rules also need to be changed to:
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]