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 | |
// URL of the sitemap | |
$sitemapUrl = "https://www.example.com/sitemap.xml"; | |
// Load the sitemap XML into a SimpleXML object | |
$sitemapXml = simplexml_load_file($sitemapUrl); | |
// Iterate over each URL in the sitemap | |
foreach ($sitemapXml->url as $url) { |
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 | |
$dbhost = "localhost"; | |
$dbuser = "dbuser"; | |
$dbpass = "dbpass"; | |
$dbname = "dbname"; | |
$conn = new mysqli($dbhost, $dbuser, $dbpass, $dbname); | |
if ($conn->connect_error) { |
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 | |
/** | |
* Script Name: Hummingbird API Quick Diagnostics | |
* Script URI: https://premium.wpmudev.org/ | |
* Description: Misc diagnostic tools used by WPMU DEV SLS Tech Support | |
* Author: James Morris @ WPMU DEV | |
* Version: 0.1 | |
* Author URI: https://premium.wpmudev.org/ | |
* | |
*/ |
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 | |
/* | |
Plugin Name: Add TOS/PP checkbox To BuddyPress Registration | |
Plugin URI: https://premium.wpmudev.org/ | |
Description: Inserts text links and checkbox to BuddyPress regtration form to confirm acceptance of terms and privacy policy prior to registration. Submit button is disabled if check box is not selected. To install on your site, upload to wp-content/mu-plugins/ | |
Author: James Morris @ WPMUDEV | |
Author URI: https://premium.wpmudev.org/ | |
License: GPLv2 or later | |
*/ | |
add_action('bp_before_registration_submit_buttons', 'bph_show_privacy_link'); |
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 | |
/* | |
Script Name: getcleanfeed | |
Plugin URI: https://premium.wpmudev.org/ | |
Description: Removes invalid line breaks and returns from source feed | |
Author: James Morris @ WPMUDEV | |
Author URI: https://premium.wpmudev.org/ | |
License: GPLv2 or later | |
*/ | |
$ch = curl_init(); |
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 | |
/* The following code forces the WPMU DEV MarketPress plugin variation | |
* modal (popup) to use 100% of the active window width. This works for | |
* both desktop and mobile. The code also applies custom CSS that makes | |
* the product image take 100% width of the parent container. The code | |
* applies to both the Store homepage and Products page. This should be | |
* added to the active theme's functions.php AFTER MarketPress has been | |
* installed and activated. | |
*/ | |
add_action( 'wp_footer', 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
/* | |
There are times when you need to find out of the IP address your domain maps to in DNS is the same | |
as the IP address of your web server's outgoing interface. This is particularly useful when dealing | |
with APIs such as eNOM. The following just performs a simple query agains http://ipecho.net/plain to | |
optain your server's outgoing IP. This can be modified with any number of similar services. | |
*/ | |
$realIP = file_get_contents("http://ipecho.net/plain"); | |
echo $realIP; |
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 | |
/* | |
Plugin Name: WPMU DEV Tools | |
Plugin URI: https://premium.wpmudev.org/ | |
Version: 0.5.2 | |
Description: Shows diagnostic information about the current server environment as well as tests cURL connectivity to <a href="https://premium.wpmudev.org" target="_blank">premium.wpmudev.org</a> and displays the debug.log. <br /><strong>Notice</strong>: This plugin utilizes <a href="http://php.net/manual/en/function.shell-exec.php" target="_blank">shell_exec()</a>. This must be enabled in PHP for full functionality. | |
Author: WPMU DEV | |
Author URI: https://premium.wpmudev.org/ | |
License: GPLv2 or later | |
*/ |
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 | |
// Removes Notices from WordPress Admin pages. | |
function remove_admin_notices() { | |
remove_all_actions( 'admin_notices' ); | |
echo "<style>.wp-admin .notice {display:none !important;}</style>"; | |
} | |
add_action( 'admin_head', 'remove_admin_notices' ); |
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 | |
// This particular example adds Hustle Social Sharing shortcode after content without editing template files on single posts/pages only. | |
function jmorris_before_after($content) { | |
$beforecontent = ''; | |
if ( is_single() ) { | |
$aftercontent = '[wd_hustle_ss id="jmorris-online"]'; | |
} else { | |
$aftercontent = ''; | |
} | |
$fullcontent = $beforecontent . $content . $aftercontent; |
NewerOlder