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 my_custom_post_types() { | |
$args = array( | |
'label' => 'Recipes', | |
'hierarchical' => true, | |
'taxonomies => array( 'post_tag' ) | |
); | |
register_post_type( 'recipe', $args ); | |
} | |
add_action( 'init', 'my_custom_post_types' ); |
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
$token = get_transient( 'twitter_access_token' ); | |
$token = ( empty( $token ) ) ? get_twitter_access_token() : $token; | |
$request = wp_remote_get('https://api.twitter.com/1.1/followers/ids.json?screen_name=danielpataki&count=5', array( | |
'headers' => array( | |
'Authorization' => 'Bearer ' . $token, | |
'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8' | |
), | |
'httpversion' => '1.1' | |
)); | |
$token = json_decode( $request['body'] ); |
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
$args = array( | |
'comment_field' => '<p class="comment-form-comment"><label for="comment">' . _x( 'Comment', 'noun' ) . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>' | |
'fields' => apply_filters( 'comment_form_default_fields', array( | |
'author' => | |
'<p class="comment-form-author">' . | |
'<label for="author">' . __( 'Name', 'domainreference' ) . '</label> ' . | |
( $req ? '<span class="required">*</span>' : '' ) . | |
'<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . | |
'" size="30"' . $aria_req . ' /></p>', |
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 my_post_guidelines() { | |
$screen = get_current_screen(); | |
if ( 'post' != $screen->post_type ) | |
return; | |
$args = array( | |
'id' => 'my_website_guide', | |
'title' => 'Content Guidelines', |
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
register_deactivation_hook( __FILE__, 'my_plugin_deactivation' ); | |
function my_plugin_deactivation() { | |
// Deactivation rules 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
add_action( 'wp_ajax_nopriv_ajax_pagination', 'my_ajax_pagination' ); | |
add_action( 'wp_ajax_ajax_pagination', 'my_ajax_pagination' ); | |
function my_ajax_pagination() { | |
echo get_bloginfo( 'title' ); | |
die(); | |
} |
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
register_activation_hook( __FILE__, 'my_plugin_create_db' ); | |
function my_plugin_create_db() { | |
// Create DB Here | |
} |
NewerOlder