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
add_shortcode( 'map', 'mgms_map' ); | |
function mgms_map( $args ) { | |
$id = substr( sha1( "Google Map" . time() ), rand( 2, 10 ), rand( 5, 8 ) ); | |
return "<div class='map' id='map-$id'></div>"; | |
} |
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
if( !function_exists( 'the_field' ) && empty( get_option( 'my-acf-notice-dismissed' ) ) ) { | |
add_action( 'admin_notices', 'my_acf_admin_notice' ); | |
} | |
function my_acf_admin_notice() { | |
?> | |
<div class="notice error my-acf-notice is-dismissible" > | |
<p><?php _e( 'ACF is not necessary for this plugin, but it will make your experience better, install it now!', 'my-text-domain' ); ?></p> | |
</div> |
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
add_action( 'admin_bar_menu', 'my_new_toolbar_item', 999 ); | |
function my_new_toolbar_item( $wp_admin_bar ) { | |
$args = array( | |
'id' => 'my_new_item', | |
'title' => 'Media Settings', | |
'href' => admin_url() . 'options-media.php', | |
); | |
$wp_admin_bar->add_node( $args ); | |
} |
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
add_role( 'company', 'Company', array( 'read' => true, 'level_0' => true, 'view_ad_stats' => 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
add_action( 'wp_ajax_nopriv_submit_content', 'my_submission_processor' ); | |
add_action( 'wp_ajax_submit_content', 'my_submission_processor' ); | |
function my_submission_processor() { | |
// Handle the form in here | |
} |
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
DELETE FROM wp_terms WHERE term_id IN (SELECT term_id FROM wp_term_taxonomy WHERE taxonomy IN ( 'unwanted_tax_1', 'unwanted_tax_2' ) ); | |
DELETE FROM wp_term_relationships WHERE term_taxonomy_id IN (SELECT term_taxonomy_id FROM wp_term_taxonomy WHERE taxonomy IN ( 'unwanted_tax_1', 'unwanted_tax_2' ) ); | |
DELETE FROM wp_term_taxonomy WHERE taxonomy IN ( 'unwanted_tax_1', 'unwanted_tax_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
/** | |
* Retrive Channel IDs | |
* | |
* This function retreives all categories which are set as channels. | |
* Channels on the website are special categories that have a mailing | |
* list attached which users can subscribe to. | |
* | |
* It returns an array of term objects if $format is set to 'objects', | |
* otherwise returns an array of term_ids. | |
* |
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
/* | |
Plugin Name: Auto Add Read Posts | |
Description: A plugin that adds read posts to the user's read list - requires the Unread Posts plugin | |
Version: 1.0.0 | |
Author: Daniel Pataki | |
Author URI: http://danielpataki.com/ | |
License: GPLv2 or later | |
*/ | |
add_action( 'wp', 'auto_add_post_to_read_list' ); |
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
public function widget( $args, $instance ) { | |
echo $args['before_widget']; | |
if( !empty( $instance['title'] ) ) { | |
echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) . $args['after_title']; | |
} | |
// Main Widget Code Here |
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
$delete_link = wp_get_shortlink( get_the_ID() ) . '&delete=true'; | |
$nonced_link = wp_nonce_url( $delete_link, 'delete-post-' . get_the_ID(), '_mynonce' ); |