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
UPDATE cp_options SET option_value = replace(option_value, 'OLD_URL', 'NEW_URL') WHERE option_name = 'home' OR option_name = 'siteurl'; | |
UPDATE cp_posts SET guid = replace(guid, 'OLD_URL', 'NEW_URL'); | |
UPDATE cp_posts SET post_content = replace(post_content, 'OLD_URL', 'NEW_URL'); | |
UPDATE cp_postmeta SET meta_value = replace(meta_value,'OLD_URL', 'NEW_URL'); | |
UPDATE cp_usermeta SET meta_value = replace(meta_value, 'OLD_URL', 'NEW_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 | |
// Define reading speed of your audience. 200 WPM is average; adjust to suit. | |
add_filter('codepotent_estimated_read_time_speed', 'codepotent_estimated_read_time_speed'); | |
function codepotent_estimated_read_time_speed($reading_speed) { | |
return 125; | |
} |
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 | |
// Change the update interval of the Discourse Stats plugin widgets. | |
function codepotent_discourse_stats_update_interval($seconds) { | |
return 86400; // 1 day | |
} | |
add_filter('codepotent_discourse_stats_update_interval', 'codepotent_discourse_stats_update_interval'); | |
// Change the date format for the "Join date" of the Discourse Stats plugin for ClassicPress. | |
// See https://www.php.net/manual/en/function.date.php for all the possible date tokens. |
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 | |
// Enable mail server ping during registration. | |
add_filter('codepotent_registration_honeypot_ping_mail_server', '__return_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 | |
// Disable shortcodes in widgets? Use this filter! | |
add_filter('codepotent_shortcodes_everywhere_widgets', '__return_false'); | |
// Disable shortcodes in excerpts? Use this filter! | |
add_filter('codepotent_shortcodes_everywhere_excerpts', '__return_false'); | |
// Disable shortcodes in category descriptions? Use this filter! | |
add_filter('codepotent_shortcodes_everywhere_terms', '__return_false'); |
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 | |
// Loose method | |
public function insert_featured_image($plugin_id, $image_path) { | |
// Get the filename from the target. | |
$filename = basename($image_path); | |
// Get thumbnail id, if any. |
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
function convert_hex2dec($hex) { | |
// Remove hashmark, if present. | |
if (substr($hex, 0, 1) === '#') { | |
$hex = substr($hex, 1); | |
} | |
// Max of 8 characters. | |
if (strlen($hex) > 8) { | |
$hex = substr($hex, 0, 8); |
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 codepotent_add_media_library_document_filter($post_mime_types) { | |
$post_mime_types['application'] = [ | |
0 => 'Documents', | |
1 => 'Manage Documents', | |
2 => [ | |
0 => 'Document (%s)', | |
1 => 'Documents (%s)', | |
'singular' => 'Document (%s)', |
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
function codepotent_get_attachment_field($select, $where, $value) { | |
// Bring database object into scope. | |
global $wpdb; | |
// Assemble the query. | |
$sql = "SELECT %s FROM $wpdb->posts WHERE %s='%s';"; | |
// Run the query. | |
$result = $wpdb->get_var($wpdb->prepare($sql, $select, $where, trim($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
/** | |
* Site policies shortcode. | |
* | |
* This shortcode creates a linked list of site policies. Any page that uses the | |
* word "policy" in the title or slug is deemed a policy to be listed. Using the | |
* shortcode [site-policies] in any post or page (or anywhere shortcodes work on | |
* your particular site,) will output a linked list the site policies. | |
* | |
* The following attributes are supported; include as many or as few as you like | |
* to get the desired result. The default behavior is to display all policies in |