This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* GA4 event: add_to_cart | |
*/ | |
add_action('wp_footer', function() { | |
if (!is_product()) return; | |
?> | |
<script type="text/javascript"> | |
// track add to cart events for products on product detail pages | |
jQuery(document).ready(function($) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// load wp | |
require_once( dirname( __FILE__ ) . '/wp-load.php' ); | |
// get post content by ID | |
if (empty($_GET['id'])) { | |
die('ID is empty'); | |
} | |
$id = $_GET['id']; | |
$post = get_post( $id ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @author Peter Morvay <[email protected]> | |
* @package Flatsome | |
* @version 3.14.3 | |
*/ | |
// Exit if accessed directly | |
if ( !defined( 'ABSPATH' ) ) exit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function pmo_home_blog() { | |
if ( is_admin() && ! defined( 'DOING_AJAX' ) ) | |
return; | |
$args = array( | |
'showposts' => 3, | |
'orderby' => 'date', | |
'order' => 'DESC', | |
'post_status' => 'publish', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Exclude scripts from WP Rocket’s defer JS option. | |
* | |
* @author Caspar Hübinger | |
* @param array $excluded_files Array of script URLs to be excluded | |
* @return array Extended array script URLs to be excluded | |
*/ | |
function exclude_files( $excluded_files = array() ) { | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo '<span style="color:green">Extracting WordPress...</span>' . PHP_EOL; | |
// Download the latest WordPress ZIP file | |
download_wordpress_zip(); | |
// Extract and move WordPress files | |
if (extract_and_move_files()) { | |
// Remove 'wordpress' folder and installer | |
remove_directory("wordpress"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Function override for Flatsome theme | |
* - disables main image link on product page | |
* | |
* @param integer $attachment_id | |
* @param bool $main_image | |
* @param string $size | |
* @return string | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Debug WP updates | |
* Displays hidden plugin and theme updates on update-core screen. | |
* | |
* @source https://stackoverflow.com/questions/22137814/wordpress-shows-i-have-1-plugin-update-when-all-plugins-are-already-updated/52132227 | |
* @author Peter Morvay <[email protected]> | |
*/ | |
function debug_pending_updates() { | |
// Rough safety nets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Blocks order if condition is met | |
* - blocks Emma Rose orders | |
* - blocks orders from New York | |
* | |
* @param array $data | |
* @param object $errors | |
* @return void | |
*/ | |
function pmo_custom_checkout_field_validation( $data, $errors ) { |
NewerOlder