This file contains hidden or 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 | |
add_action( 'rest_api_init', 'custom_routes_webhook_0277'); | |
function custom_routes_webhook_0277(){ | |
//(exemplo: /wp-json/exemplo/notificacoes) | |
register_rest_route( | |
'exemplo', '/notificacoes/', array( | |
'methods' => 'POST', |
This file contains hidden or 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 | |
// Custom registration form for WooCommerce | |
function custom_woocommerce_register_form() { | |
$user_role = ( ! empty( $_POST['user_role'] ) ) ? sanitize_text_field( $_POST['user_role'] ) : ''; | |
$company_id = ( ! empty( $_POST['company_id'] ) ) ? sanitize_text_field( $_POST['company_id'] ) : ''; | |
?> | |
<p class="form-row form-row-wide"> | |
<label for="user_role"><?php _e( 'Choose account type', 'woodmart' ); ?></label> |
This file contains hidden or 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 | |
// GitHub webhook secret (set this in your GitHub webhook settings) | |
$secret = "Y0UR-secret-text-here!"; | |
// Get the payload | |
$payload = file_get_contents('php://input'); | |
// Verify the signature | |
$signature = $_SERVER['HTTP_X_HUB_SIGNATURE'] ?? null; |
This file contains hidden or 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 | |
/** | |
* Elementor Conditions based on Page Template | |
* | |
* @return void | |
*/ | |
add_action( 'elementor/theme/register_conditions', function( $conditions_manager ) { | |
class Page_Template_Condition extends ElementorPro\Modules\ThemeBuilder\Conditions\Condition_Base { |
This file contains hidden or 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
/** | |
* Checks form textarea content is english to reduce spam from non-english bots | |
**/ | |
function elementor_form_message_field_validation( $field, $record, $ajax_handler ) { | |
// Let's check the message field only | |
if ( empty( $field ) || empty( $field['message'] ) ) { | |
return; | |
} | |
// Validate content format by language | |
$string = $field['message']; |
This file contains hidden or 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
add_action( 'elementor/query/myonmarketpropertyquery', 'elementor_query_on_market_only' ); | |
function elementor_query_on_market_only( $query ) | |
{ | |
$meta_query = $query->get('meta_query'); | |
$new_meta_query = $meta_query; | |
$new_meta_query[] = array( | |
'key' => '_on_market', | |
'value' => 'yes' |
This file contains hidden or 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
jQuery(document).ready(function($) { | |
var delay = 100; setTimeout(function() { | |
$('.elementor-tab-title').removeClass('elementor-active'); | |
$('.elementor-tab-content').css('display', 'none'); }, delay); | |
}); |
This file contains hidden or 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 | |
/** | |
* @credits https://jeroensormani.com/adding-a-custom-woocommerce-product-type/ | |
*/ | |
//error_reporting(E_ALL); | |
//ini_set('display_errors', 1); | |
add_action('init' , 'wc_pm_load_product_type'); | |
function wc_pm_load_product_type() { |
This file contains hidden or 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 | |
$posts = maybeCache('remote_posts_data', 7200, function () { | |
return do_remote_get('https://jsonplaceholder.typicode.com/posts/'); | |
}); | |
foreach ($posts as $post) { | |
echo "<h2>{$post->title}</h2>"; | |
} |
This file contains hidden or 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 | |
add_action('wp_enqueue_scripts', 'enqueue_if_shortcode'); | |
function enqueue_if_shortcode(){ | |
global $post; | |
if ( $post && has_shortcode( $post->post_content, 'your_shortcode_tag' ) { | |
// Enqueue | |
} |
NewerOlder