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 price and visibility | |
function mmwd_update_frontend_woocommerce_fields( $post_id, $form_id, $form_settings, $form_vars ){ | |
// update _price depending on _sale_price or _regular_price | |
$_price = ( $_POST['_sale_price'] ) ? esc_html( $_POST['_sale_price'] ) : esc_html( $_POST['_regular_price'] ); | |
update_post_meta( $post_id, '_price', $_price ); | |
// update _visibility | |
update_post_meta( $post_id, '_visibility', 'visible' ); |
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 title_format( $content ) { | |
return '%s'; | |
} | |
add_filter( 'private_title_format', 'title_format' ); | |
add_filter( 'protected_title_format', 'title_format' ); |
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
/** | |
* Show only free shipping option when available | |
* | |
* @param array $available_methods | |
*/ | |
function show_only_free_shipping( $available_methods ) { | |
if( isset( $available_methods['free_shipping'] ) ) : | |
// Get Free Shipping array into a new array |
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
/** | |
* Login logo | |
*/ | |
function mmuk_custom_login_logo() { | |
echo '<style type="text/css"> | |
h1 a { background-image:url(' . get_stylesheet_directory_uri() . '/login-logo.png) !important; background-size: 320px 80px !important; width: 320px !important; } | |
</style>'; | |
} | |
add_action('login_head', 'mmuk_custom_login_logo'); |
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_content(); ?> |
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 | |
$required_paragraphs = 3; | |
$content = apply_filters( 'the_content', $post->post_content ); | |
if( substr_count ( $content, '<p>' ) > $required_paragraphs ){ | |
$contents = explode( "</p>", $content ); | |
$paragraphs = 1; | |
foreach( $contents as $content ){ | |
echo $content; | |
if( $paragraphs == $required_paragraphs ){ | |
/* Advert 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
<?php | |
/** | |
* get copyright date | |
*/ | |
function copydate(){ | |
$first_year = 2011; | |
$this_year = date("Y"); | |
if ($this_year == $first_year){ | |
$copyright_date = $first_year; | |
} |
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 echo copydate(); ?> [Your business name 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
function mmuk_replace_howdy_message( $wp_admin_bar ) { | |
$my_account = $wp_admin_bar -> get_node( 'my-account' ); | |
$newtitle = str_replace( 'Howdy,', 'Logged in as', $my_account->title ); | |
$wp_admin_bar -> add_node( array( | |
'id' => 'my-account', | |
'title' => $newtitle, | |
) ); | |
} | |
add_filter( 'admin_bar_menu', 'mmuk_replace_howdy_message',25 ); |
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
From: "Example User" <[email protected]> |
OlderNewer