Skip to content

Instantly share code, notes, and snippets.

<?php
add_filter( 'nextgenthemes/arve/iframe_attr', 'arve_emergency_ref_patch' );
function arve_emergency_ref_patch( $attr ) {
$attr['referrerpolicy'] = false;
return $attr;
}
@nextgenthemes
nextgenthemes / debug-http-request.php
Created March 26, 2024 21:15 — forked from maheshwaghmare/debug-http-request.php
Debug the HTTP requests in WordPress wp_remote_post() or wp_remote_get() with the help of `http_api_debug` hook.
<?php
/**
* Debug HTTP requests in WordPress
*
* Fires after an HTTP API response is received and before the response is returned.
*
* Output in `wp-content\debug.log` file:
*
* [24-Apr-2019 06:50:16 UTC] ------------------------------
* [24-Apr-2019 06:50:16 UTC] https://downloads.wordpress.org/plugin/elementor.2.5.14.zip
@nextgenthemes
nextgenthemes / fn-php80-str-polyfills.php
Last active February 21, 2024 10:58
Proper minimalistic str_contains, str_starts_with and str_ends_with polyfills with WordPress coding standards
<?php
/**
* These are based on symfony/polyfill-php80. The aim of this is to have a minimalistic polyfill
* for only the str_* functions of PHP 8.0. Requires php 7.1 or higher.
*
* @link https://github.com/symfony/polyfill-php80/blob/1.x/bootstrap.php
* @link https://github.com/symfony/polyfill-php80/blob/1.x/Php80.php
*
* @license GPL-3.0
* @copyright (c) Fabien Potencier <[email protected]>, (c) 2024 Nicolas Jonas nextgenthemes.com
@nextgenthemes
nextgenthemes / arve-title-replacer.php
Created March 28, 2023 02:56
Replace header tags in ARVE
<?php
add_filter( 'nextgenthemes/arve/title_html', 'arve_custom_title_tag' );
function arve_custom_title_tag( $html ) {
$html = strtr(
$html,
[
'<h5' => '<h2',
'</h5>' => '</h2>',
<?php
function my_arve_image_only( $url ) {
add_filter( 'arve_output', 'my_arve_only_img_filter', 10, 3 );
echo do_shortcode( sprintf( '[arve url="%s" /]', $url ) );
remove_filter( 'arve_output', 'my_arve_only_img_filter', 10, 3 );
}
function my_arve_only_img_filter( $output, $html_parts, $atts ) {
@nextgenthemes
nextgenthemes / plymouth-preview.sh
Created April 16, 2013 14:09
preview plymouth theme on ubuntu
#!/bin/bash
## Preview Plymouth Splash ##
## by _khAttAm_ ##
## www.khattam.info ##
## License: GPL v3 ##
chk_root () {
if [ ! $( id -u ) -eq 0 ]; then