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
// Create random slug for custom post | |
function func_update_post_name( $post_id, $post ){ | |
if ( 'post-type-slug' == $post->post_type ) { | |
remove_action( 'save_post', 'func_update_post_name',30,2 ); | |
// update the post slug | |
wp_update_post( array( | |
'ID' => $post_id, |
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 columns to post list | |
*/ | |
function add_acf_columns ( $columns ) { | |
return array_merge ( $columns, array ( | |
'custom_column' => __ ( 'Custom column' ), | |
) ); | |
} | |
add_filter ( 'manage_postname_posts_columns', 'add_acf_columns' ); |
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 sliderstyle sheet. | |
//add_action( 'wp_enqueue_scripts', 'theme_register_slider_style' ); | |
/** | |
* Register style sheet. | |
*/ | |
/* | |
function theme_register_slider_style() { | |
wp_register_style( 'slider', get_stylesheet_directory_uri() . '/css/slider.min.css', 'soliloquy-style-css' ); | |
wp_enqueue_style( 'slider' ); |
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
global $product; | |
if ($product->is_in_stock()) { | |
//Do if product is in stock | |
} |
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: Multisite: Passwort Reset on Local Blog | |
* Plugin URI: https://gist.github.com/eteubert/293e07a49f56f300ddbb | |
* Description: By default, WordPress Multisite uses the main blog for passwort resets. This plugin enables users to stay in their blog during the whole reset process. | |
* Version: 1.0.0 | |
* Author: Eric Teubert | |
* Author URI: http://ericteubert.de | |
* License: MIT | |
*/ |
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
//* change slug for post type | |
$args = get_post_type_object("post_type_name"); | |
$args->rewrite["slug"] = "new_slug"; | |
register_post_type($args->name, $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
function mail_filter_wp_mail_from($email){ | |
return "[email protected]"; | |
} | |
add_filter("wp_mail_from", "mail_filter_wp_mail_from"); |
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_filter('relevanssi_match', 'date_weights'); | |
function date_weights($match) { | |
$EM_Event = em_get_event($match->doc, 'post_id'); | |
$enddate = $EM_Event->event_end_date; | |
$yesterday = time() - 24*60*60;; | |
if (strtotime($enddate) > $yesterday) { | |
$match->weight = $match->weight * 2; | |
} | |
else { |
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 | |
// Changes the text labels for Google Calendar and iCal buttons on a single event page | |
remove_action('tribe_events_single_event_after_the_content', array('Tribe__Events__iCal', 'single_event_links')); | |
add_action('tribe_events_single_event_after_the_content', 'customized_tribe_single_event_links'); | |
function customized_tribe_single_event_links() { | |
if (is_single() && post_password_required()) { | |
return; | |
} | |
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 | |
//Redirects author archives, DON'T check "Disable Extra User Archives" in iThemes security | |
add_action( 'template_redirect', 'my_redirect_author_archive' ); | |
function my_redirect_author_archive() { | |
if ( is_author() ) { | |
wp_redirect( home_url(), 302 ); | |
exit; | |
} |
NewerOlder