Skip to content

Instantly share code, notes, and snippets.

View jamiecalabro's full-sized avatar

Jamie Calabro jamiecalabro

View GitHub Profile
<?php
namespace App\Nova;
use App\Nova\Fields\DateTime;
use Carbon\CarbonImmutable;
use Cron\CronExpression;
use Illuminate\Http\Request;
use Laravel\Nova\Fields\Boolean;
use Laravel\Nova\Fields\Text;
@trey8611
trey8611 / http-api-curl-options-custom.md
Last active March 29, 2025 21:10
[Change cURL Header and other options] Change timeout settings, headers, pass tokens, etc. #curl #download-from-url

You can use the http_api_curl hook to change timeout settings, headers, etc, when downloading a feed via URL with WP All Import.

There are example snippets below that you can modify for your use case. This code needs to be saved in your child theme's functions.php file, or in a plugin like Code Snippets.

Examples

Basic Authentication (base64_encode)

add_action( 'http_api_curl', 'example_set_curl_auth', 10, 3 );
function example_set_curl_auth( $handle, $r, $url ) {
@tarecord
tarecord / get_primary_taxonomy_term.php
Last active October 7, 2023 18:16
Returns the primary term for the chosen taxonomy set by Yoast SEO or the first term selected.
<?php
/**
* Returns the primary term for the chosen taxonomy set by Yoast SEO
* or the first term selected.
*
* @link https://www.tannerrecord.com/how-to-get-yoasts-primary-category/
* @param integer $post The post id.
* @param string $taxonomy The taxonomy to query. Defaults to category.
* @return array The term with keys of 'title', 'slug', and 'url'.
*/
@MelMacaluso
MelMacaluso / expose_ACF_fields_to_REST.php
Created June 4, 2019 22:54
Automatically expose all the ACF fields to the Wordpress REST API in Pages and in your custom post types.
<?php
function create_ACF_meta_in_REST() {
$postypes_to_exclude = ['acf-field-group','acf-field'];
$extra_postypes_to_include = ["page"];
$post_types = array_diff(get_post_types(["_builtin" => false], 'names'),$postypes_to_exclude);
array_push($post_types, $extra_postypes_to_include);
foreach ($post_types as $post_type) {
register_rest_field( $post_type, 'ACF', [
@bradtraversy
bradtraversy / docker_wordpress.md
Last active May 3, 2025 05:33
Docker Compose FIle For Wordpress, MySQL & phpmyadmin

Wordpress & Docker

This file will setup Wordpress, MySQL & PHPMyAdmin with a single command. Add the code below to a file called "docker-compose.yaml" and run the command

$ docker-compose up -d

# To Tear Down
$ docker-compose down --volumes
@paulund
paulund / SmokeGuestTest.php
Last active April 12, 2024 15:56
Example of smoke testing guest URLs in a Laravel application
<?php
namespace Tests\Feature\SmokeTests;
use App\Models\Post;
use App\Models\Tutorial;
use Illuminate\Routing\Router;
use Tests\TestCase;
class SmokeGuestTest extends TestCase
@phillip-boombox
phillip-boombox / functions.php
Last active June 5, 2021 19:36
WordPress: Required plugins from the plugins repository
add_filter( 'install_plugins_tabs', 'cmfy_required_plugins_tab' );
function cmfy_required_plugins_tab( $tabs ) {
$tabs['cmfy'] = _x( 'Required', 'Plugin Installer', 'cmfy' );
return $tabs;
}
add_action( 'install_plugins_cmfy', 'cmfy_required_plugins_page' );
function cmfy_required_plugins_page() {
$required_plugin_slugs = array(
'cmb2',
@seoagentur-hamburg
seoagentur-hamburg / .htaccess
Last active April 24, 2025 10:23
UPDATE 2024/03: Perfect .htaccess file for highspeed and security. You can use it for every WordPress-Website without problems. Highspeed and Security - testet on hundreds of Websites. If you are using a WordPress Multisite, change the last part of this file.
########################################################################
# OPTIMAL .htaccess FILE FOR SPEED AND SECURITY @Version 2.0.9 - 03/2024
# ----------------------------------------------------------------------
# @Author: Andreas Hecht
# @Author URI: https://seoagentur-hamburg.com
# License: GNU General Public License v2 or later
# License URI: http://www.gnu.org/licenses/gpl-2.0.html
########################################################################
@joseluisq
joseluisq / 1README.md
Created April 19, 2017 07:33
How add a custom field to Laravel 5.4 default login. LoginController.php

How add a custom field to Laravel 5.4 default login controller.

In this php example (app/Http/Controllers/Auth/LoginController.php) my model is called Client and the custom field for login validation is status. (Client->status)

Add in your resources/lang/en/auth.php file :

    'failed_status' => 'Your account is inactive yet. Please confirm your e-mail address.',
@ralphtheninja
ralphtheninja / cleanup_docker.sh
Created December 22, 2016 23:05 — forked from jaronkk/cleanup_docker.sh
Cleanup and reset docker on Jenkins workers / slaves
#!/bin/bash
# This script should be located on each Jenkins slave, and the jenkins user should have permission to run it with sudo
# Attempts to cleanly stop and remove all containers, volumes and images.
docker ps -q | xargs --no-run-if-empty docker stop
docker ps -q -a | xargs --no-run-if-empty docker rm --force --volumes
docker volume ls -q | xargs --no-run-if-empty docker volume rm
docker images -a -q | xargs --no-run-if-empty docker rmi -f
# Stops the docker service, unmounts all docker-related mounts, removes the entire docker directory, and starts docker again.