Skip to content

Instantly share code, notes, and snippets.

/*
modifiying the general wp_query and adding the suppress filters to be off all the time
*/
add_action( '__before_loop' , 'modify_main_wp_query1' );
add_action( '__after_loop' , 'modify_main_wp_query1' );
function modify_main_wp_query1() {
global $wp_query;
/* paste this into your functions.php of the theme */
/ * Join posts and postmeta tables */
function product_search_join( $join ) {
if( ! is_search() || ! is_woocommerce() ) {
return $join;
}
global $wpdb;
UPDATE wp_options SET option_value = replace(option_value, 'http://sezavino.mk', 'https://sezavino.mk') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://ivankarangelova.com','https://sezavino.mk');
UPDATE wp_posts SET post_content = replace(post_content, 'http://ivankarangelova.com', 'https://sezavino.mk');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://ivankarangelova.com','https://sezavino.mk');
@mmilosheski
mmilosheski / hide-prices-logged-out-show-logged-in.php
Created January 11, 2017 09:41
Removes the prices on products when customer is not logged in.. Shows prices when the customer is logged in
<?php
// Hide prices
add_filter('woocommerce_get_price_html', 'show_price_logged');
function show_price_logged($price){
if(is_user_logged_in() ) {
return $price;
} else {
add_action( 'woocommerce_single_product_summary', 'print_login_to_see', 31 );
add_action( 'woocommerce_after_shop_loop_item', 'print_login_to_see', 11 );
/*mile test */
function make_filename_hash($filename) {
if( isset($_REQUEST['post_id']) ) {
$post_id = (int)$_REQUEST['post_id'];
}else{
$post_id=0;
}
$info = pathinfo($filename);
$ext = empty($info['extension']) ? '' : '.' . $info['extension'];
$username = $_POST['fs_username'];
$password = $_POST['fs_password'];
echo "<pre>";
var_dump("Username: ", $username, "Password: ", $password);
echo "</pre>";
$api_login_url = "https://servicesbeta.fidelitysalus.it/v3/account/login";
$login_response = wp_remote_retrieve_body(wp_remote_post( $api_login_url, array(
'method' => 'POST',
@mmilosheski
mmilosheski / gist:0ec054737f652bca9356
Created October 1, 2015 16:31
wordpress add to database table
/// HTML PAGE TEMPLATE SHOULD HAVE THIS CODE (KEEP IN MIND THAT THE INSERT.PHP IS IN THE TEMPLATE DIR
<form action="<?php echo get_template_directory_uri(); ?>/insert.php" method="post">
Name:<input type="text" name="name"/>
<input type="submit" name="submit"/>
</form>
/// THE INSERT.PHP FILE SHOULD HAVE THIS CODE
<?php
global $wpdb