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 | |
/** | |
* @author Mohammad Murslaeen | |
* @function to redirect to attachment url from attachment page url | |
*/ | |
function mm_media_page_url_to_attachment_url(){ | |
if( 'attachment' != get_post_type( get_the_ID() ) ) | |
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 | |
add_action('woocommerce_before_single_product','mm_display_variations_with_prices'); | |
function mm_display_variations_with_prices(){ | |
global $product,$woocommerce; | |
$variations = $product->get_available_variations(); |
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 | |
$no_result = true; | |
// Getting XML Response | |
if(isset($_GET['q'])){ // Assuming we have got some search query by get method at q index | |
$query = $_GET['q']; | |
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 | |
/** | |
* @author : Mohammad Mursaleen | |
* @usage : Send Post Request to URL and get response using PHP | |
*/ | |
$url = 'URL'; | |
$data = array('field1' => 'value', 'field2' => 'value'); | |
$options = 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
<?php | |
/** | |
* @author Mohammad Mursaleen | |
* @usage function to get unique transient key | |
* @return string: transient key | |
*/ | |
function objects_get_transient_identifier( $key = '' ){ | |
return $key . '_' . objects_get_ip_address(); |
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 | |
/** | |
* @author Mohammad Mursaleen | |
* @usage function to get unique transient key | |
* @return string: transient key | |
*/ | |
function objects_get_transient_identifier( $key = '' ){ | |
return $key . '_' . objects_get_ip_address(); |
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 | |
/** | |
* @author Mohammad Mursaleen | |
* @usage Allow other user roles to access admin area to manage their profiles from dashboard - WooCommerce Quick fix | |
*/ | |
add_filter( 'woocommerce_prevent_admin_access', 'objects_woocommerce_login_redirect_fix' , 20 , 1 ); | |
function objects_woocommerce_login_redirect_fix($prevent_access){ | |
$prevent_access = 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 | |
/** | |
* @author Mohammad Mursaleen | |
* @usage to make sub items of bundle product manageable in cart | |
*/ | |
function mm_make_sub_items_manageable_in_cart(){ | |
if( function_exists( 'WC_PB' ) ) | |
remove_filter( 'woocommerce_cart_item_quantity', array( WC_PB()->cart , 'woo_bundles_cart_item_quantity' ), 10, 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
<?php | |
// To add custom data above add to cart button in woocommerce | |
// step 1 | |
add_action('wp_ajax_wdm_add_user_custom_data_options', 'wdm_add_user_custom_data_options_callback'); | |
add_action('wp_ajax_nopriv_wdm_add_user_custom_data_options', 'wdm_add_user_custom_data_options_callback'); | |
function wdm_add_user_custom_data_options_callback() |
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 | |
/********************************************************************************/ | |
/*** WordPress Ajax code to add emails in post meta with postid in front end ***/ | |
/********************************************************************************/ | |
add_action( 'wp_footer', 'my_action_javascript' ); | |
function my_action_javascript() { ?> | |
<script type="text/javascript" > |
NewerOlder