Skip to content

Instantly share code, notes, and snippets.

View NorthTexasCreative's full-sized avatar

Carla Chalmers NorthTexasCreative

  • North Texas Creative, LLC
  • Stephenville, TX
View GitHub Profile
// Get WordPress site name via shortcode: [nf_site_name]
function nf_site_name_shortcode() {
return get_bloginfo('name');
}
add_shortcode('nf_site_name','nf_site_name_shortcode');
@NorthTexasCreative
NorthTexasCreative / Classified-Listing-Sample-data.json
Created November 5, 2023 11:57 — forked from radiustheme/Classified-Listing-Sample-data.json
How to import sample data for classified listing like categories & locations
{
"locations": [
{
"name": "New York",
"slug": "",
"description": "",
"meta": [
{"image_id" : 45},
{"_icon" : ""}
],
@NorthTexasCreative
NorthTexasCreative / tjkelly-screaming-frog-exclude-wordpress.txt
Created January 26, 2023 19:54 — forked from tjkelly/tjkelly-screaming-frog-exclude-wordpress.txt
WordPress URL Exclude List for Screaming Frog Spider
/**
* WordPress URL Exclude List for Screaming Frog Spider
* @author TJ Kelly - https://tjkelly.com
* @desc Full article — https://tjkelly.com/blog/screaming-frog-exclude-wordpress/
* @date 2021-07-08
*/
https://example.com/wp-content/.*
https://example.com/wp-content/mu-plugins/.*
https://example.com/wp-content/plugins/.*
@NorthTexasCreative
NorthTexasCreative / wsl2-ubuntu-lamp.md
Created November 15, 2022 02:08 — forked from abobija/wsl2-ubuntu-lamp.md
LAMP stack on WSL2 (Ubuntu 20.04) - Apache, MySQL, PHP, PhpMyAdmin

LAMP stack on WSL2 (Ubuntu 20.04) - Apache, MySQL, PHP, PhpMyAdmin

Apache

sudo apt-get update && sudo apt-get upgrade 
sudo apt-get install -y apache2

PHP

@NorthTexasCreative
NorthTexasCreative / hosts
Created September 26, 2022 19:00 — forked from monkishtypist/hosts
Nginx virtual host example for Windows Subsystem for Linux (WSL)
# Location: /mnt/c/windows/system32/drivers/etc/hosts
127.0.0.1 virtualhost.local www.virtualhost.local
@NorthTexasCreative
NorthTexasCreative / function.php
Created August 20, 2022 00:07 — forked from mattclements/function.php
Wordpress Disable Comments (add to function.php)
<?php
add_action('admin_init', function () {
// Redirect any user trying to access comments page
global $pagenow;
if ($pagenow === 'edit-comments.php') {
wp_redirect(admin_url());
exit;
}
@NorthTexasCreative
NorthTexasCreative / functions.php
Created January 6, 2021 02:39 — forked from grantambrose/functions.php
Add content to the vertical menu in the Beaver Builder Theme
// Add a Beaver Builder Template to the bottom of the Beaver Builder Theme vertical menu
add_filter( 'wp_nav_menu_items', 'your_custom_menu_item', 10, 2 );
function your_custom_menu_item ( $items, $args ) {
// if the menu is in fact our header menu
if ($args->theme_location == 'header') {
// get the content of our Beaver Builder Template
$bb_content = do_shortcode('[fl_builder_insert_layout slug="vertical-menu-content-bottom"]');
// append the content of our Beaver Builder Template to the end of our menu
$items .= $bb_content;
}
SELECT CONCAT( 'ALTER TABLE ', TABLE_NAME, ' ENGINE=InnoDB;' )
FROM INFORMATION_SCHEMA.TABLES
WHERE ENGINE = 'MyISAM'
AND table_schema = 'database-name-here';
@NorthTexasCreative
NorthTexasCreative / remove-woo-scripts.php
Created March 2, 2020 21:26 — forked from jan-koch/remove-woo-scripts.php
Remove WooCommerce related resources except on WooCommerce-based pages (products, cart, checkout, etc). Use on a testing environment before pasting this into your live website!
/**
* This code snippet removes JavaScript and CSS files loaded from WooCommerce if they are not necessary.
*
* Please test this on a staging copy of your website before putting this into the functions.php of your live website.
*/
add_action( 'wp_enqueue_scripts', 'my_remove_woo_assets', 99 );
function my_remove_woo_assets() {
if ( function_exists( 'is_woocommerce' ) ) { // Check if Woo is installed.
if ( ! is_woocommerce() && ! is_cart() && ! is_checkout() ) { // Only run on non-Woo pages.
// Remove unnecessary stylesheets.
@NorthTexasCreative
NorthTexasCreative / block-helpers.php
Created January 25, 2020 16:43 — forked from clarklab/block-helpers.php
Wordpress check if block is used first
<?php
/**
* Block helpers
* add special classes when certain blocks appear, put this in your functions.php file or include it somewhere
*/
// add block classes in body and post class
function blocks_body_class( $classes ) {
global $post;