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 pgmb_add_custom_variable($variables, $parent_post_id){ | |
$variables['%custom_variable%'] = get_post_meta($parent_post_id, 'custom_variable', true); | |
return $variables; | |
} | |
add_filter('mbp_placeholder_variables', 'pgmb_add_custom_variable', 10, 2); |
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 | |
add_action('admin_head', 'pgmb_increase_height'); | |
function pgmb_increase_height() { | |
echo '<style> | |
.mbp-business-selector { | |
height:100% !important; | |
} | |
</style>'; | |
} |
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 pgmb_add_calendarize_it_fields( $variables, $parent_post_id ) { | |
$event_start_date = get_post_meta( $parent_post_id, 'fc_start_datetime', true ); | |
$event_end_date = get_post_meta( $parent_post_id, 'fc_end_datetime', true ); | |
if ( ! $event_start_date || !$event_end_date ) { | |
return $variables; | |
} | |
$start_datetime = new \DateTime($event_start_date); |
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 pgmb_batch_update_templates(){ | |
$product_ids = get_posts([ | |
'post_type' => 'product', | |
'fields' => 'ids', | |
'numberposts' => '-1', | |
]); | |
foreach($product_ids as $product_id){ | |
$product = wc_get_product($product_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 | |
function pgmb_add_event_fields( $variables, $parent_post_id ) { | |
$event_start_date = get_post_meta( $parent_post_id, 'WooCommerceEventsDateTimestamp', true ); | |
$event_end_date = get_post_meta( $parent_post_id, 'WooCommerceEventsEndDateTimestamp', true ); | |
if ( ! $event_start_date || !$event_end_date ) { | |
return $variables; | |
} | |
$start_datetime = new \DateTime(); |
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 | |
//Remove the <?php opening tag to get rid of the red exclamation mark in the Code Snippets plugin | |
if(interface_exists('\PGMB\Placeholders\VariableInterface')){ | |
class PGMB_WC_Variation_Prices implements \PGMB\Placeholders\VariableInterface{ | |
private $product; | |
public function __construct($parent_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 | |
function pgmb_insert_content_img($localPost, $post_id, $is_autopost, $location){ | |
if( | |
!class_exists('DOMDocument') || | |
!class_exists('\PGMB\Google\MediaItem') | |
){ return $localPost; } | |
$form_fields = get_post_meta($post_id, 'mbp_form_fields', true); |
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 pgmb_add_acf_fields($variables, $parent_post_id){ | |
//Check if the ACF get_fields function is actually available | |
if(!function_exists('get_fields')){ return $variables; } | |
$fields = get_fields($parent_post_id); | |
if($fields){ | |
foreach($fields as $name => $value){ | |
$variables["%acf_{$name}%"] = $value; |
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 | |
if(interface_exists('\PGMB\Placeholders\VariableInterface')){ | |
class PGMBYoastSEOVariables implements \PGMB\Placeholders\VariableInterface { | |
private $parent_id; | |
public function __construct($parent_id) { | |
$this->parent_id = $parent_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 | |
class PGMBRankMathSEOVariables implements \PGMB\Placeholders\VariableInterface { | |
private $parent_id; | |
public function __construct($parent_id) { | |
$this->parent_id = $parent_id; | |
} |