Skip to content

Instantly share code, notes, and snippets.

@koen12344
koen12344 / pgmb_rank_math_seo.php
Created Nov 29, 2021
Rankmath description variable in Post to Google My Business plugin
View pgmb_rank_math_seo.php
<?php
class PGMBRankMathSEOVariables implements \PGMB\Placeholders\VariableInterface {
private $parent_id;
public function __construct($parent_id) {
$this->parent_id = $parent_id;
}
@koen12344
koen12344 / wp-increase-timeout.php
Last active Oct 5, 2021 — forked from sudar/wp-increase-timeout.php
Increase the curl timeout in WordPress
View wp-increase-timeout.php
<?php
//Copied from http://fatlabmusic.com/blog/2009/08/12/how-to-fix-wp-http-error-name-lookup-timed-out/
//adjustments to wp-includes/http.php timeout values to workaround slow server responses
add_filter('http_request_args', 'pgmb_http_request_args', 100, 1);
function pgmb_http_request_args($r) //called on line 237
{
$r['timeout'] = 15;
return $r;
}
View pgmb_gravity_forms_advanced_post_creation.php
<?php
/**
Snippet to create GMB posts from the Advanced Post Creation plugin of Gravity Forms
**/
function pgmb_gf_create_post_advancedpostcreation($post_id, $feed, $entry, $form){
$subpost = new \PGMB\PostTypes\SubPost();
View pgmb_gravity_forms_fields.php
<?php
function pgmb_gf_post_created($post_id, $feed, $entry, $form){
global $post_to_google_my_business_plugin;
$post_type = 'your_post_type';
// -- Do not edit after this
//If this is a different post type, abort
View pgmb_change_save_post_priority.php
<?php
/**
Function to change the order of the save_post execution. Change the $priority value to change the priority
lower numbers mean earlier execution.
**/
function pgmb_change_autopost_priority(){
@koen12344
koen12344 / snippet_motors_car_data.php
Last active May 11, 2021
Motors WordPress plugin add car data to Post to Google My Business plugin
View snippet_motors_car_data.php
<?php
class PGMB_Motors_Variables implements \PGMB\Placeholders\VariableInterface {
private $listing_id;
public function __construct($listing_id){
$this->listing_id = $listing_id;
}
/**
@koen12344
koen12344 / snippet_wp_download_manager_tags.php
Created Apr 28, 2021
Adds a multitude of data variables from the WP Download Manager plugin to the Post to Google My Business plugin
View snippet_wp_download_manager_tags.php
<?php
/*
This code snippet adds various info about downloads from the WP Download Manager plugin to Post to Google My Business
%wpdm_access%
%wpdm_download_count%
%wpdm_view_count%
%wpdm_version%
%wpdm_link_label%
@koen12344
koen12344 / hide_user_locations.php
Created Jan 26, 2021
Hide specific locations from users in Post to GMB plugin
View hide_user_locations.php
<?php
/*
It is possible to limit the location list to specific locations (or a single location) using the mbp_get_locations filter.
We can use it to filter out the locations that don't belong to the website or user.
The code loops through all locations and checks whether the location is within an array of allowed locations. If not, it is removed (hidden).
You can find the location ID by right clicking the location in the location selector, and pressing "Inspect Element": https://i.imgur.com/gWd5M9x.png