Skip to content

Instantly share code, notes, and snippets.

View trueqap's full-sized avatar
🎯
Focusing

TrueQAP trueqap

🎯
Focusing
View GitHub Profile
<?php
/**
* Plugin Name: Ingyenes szállítási küszöb - WooCommerce
* Plugin URI: https://github.com/trueqap/ingyenes-szallitasi-kuszob-woocommerce
* Description: A bővítmény segítségével kiírhatjuk a kosár oldalra, hogy mennyit kell még vásárolni az ingyenes szállításig.
* Version: 1.0
* Author: Trueqap
* Author URI: https://github.com/trueqap/
* License: GPL2
*/
<?php
function posts_for_current_author($query) {
global $pagenow;
if( 'edit.php' != $pagenow || !$query->is_admin )
return $query;
if( !current_user_can( 'edit_others_posts' ) ) {
global $user_ID;
@trueqap
trueqap / woo_simple_or_variable.php
Last active January 16, 2018 12:55
WooCommerce simple or variable product
?php
$product = new WC_Product( get_the_ID() ); // in function.php maybe...
if( $product->is_type( 'simple' ) ){
// a simple product
} elseif( $product->is_type( 'variable' ) ){
<?php
function egyedi_jellemzok() {
echo'IDE JÖHET MINDEN SZÖVEG, AKÁR HTML IS, VAGY SCRIPT';
}
add_action('woocommerce_after_add_to_cart_button', 'egyedi_jellemzok');
@trueqap
trueqap / del_woo_products_with_ attachment.php
Created January 23, 2018 11:31
Delete WooCommerce products with images (attachment)
<?php
function delete_associated_media( $id ) {
$media = get_children( array(
'post_parent' => $id,
'post_type' => 'attachment'
) );
if( empty( $media ) ) {
return;
@trueqap
trueqap / hide_admin.php
Created January 25, 2018 06:34
Hide admin for NON-ADMIN users WordPress - Redirect non-admin users to home page
<?php
add_action( 'admin_init', 'redirect_non_admin_users' );
function redirect_non_admin_users() {
if ( ! current_user_can( 'manage_options' ) && '/wp-admin/admin-ajax.php' != $_SERVER['PHP_SELF'] ) {
wp_redirect( home_url() );
exit;
}
}
@trueqap
trueqap / domain_renamer.sql
Last active July 14, 2019 00:38
WordPress domain csere után futtatható mySQL parancsok. Segítségével átírhatjuk pár kattintással a régi webcímet az újra
UPDATE wp_options SET option_value = replace(option_value, 'http://regiwebcim.hu', 'http://ujwebcim.hu') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://regiwebcim.hu','http://ujwebcim.hu');
UPDATE wp_posts SET post_content = replace(post_content, 'http://regiwebcim.hu', 'http://ujwebcim.hu');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://regiwebcim.hu','http://ujwebcim.hu');
UPDATE wp_options SET option_value = replace(option_value, 'http://regiwebcim.hu', 'http://ujwebcim.hu');
<?php
//Részletek itt: https://wphu.org/tippek-trukkok/hogyan-jussunk-wordpress-adminba-hozzaferes-nelkul/
require_once('wp-blog-header.php');
require_once('wp-includes/registration.php');
$newusername = 'wphu.org-potkulcs';
$newpassword = 'wphu.org-potjelszo';
@trueqap
trueqap / Hide_price_in_woocommerce.php
Created January 26, 2018 07:53
WooCommerce ár eltüntetése
<?php
//https://wphu.org/kozosseg/tema/targy-eszkoz-lefoglalo-plugin/#post-263704
add_filter( 'woocommerce_variable_sale_price_html', 'ar_torles', 10, 2 );
add_filter( 'woocommerce_variable_price_html', 'ar_torles', 10, 2 );
add_filter( 'woocommerce_get_price_html', 'ar_torles', 10, 2 );
function ar_torles( $price, $product ) {
$price = '';
@trueqap
trueqap / Date_time_on_WooCommerce_order_page.php
Last active January 28, 2018 06:37
Add time and date to WooCommerce order page with new column.
<?php
//https://woopress.hu/forumok/tema/rende/
function RENDELES_DATUMA_ES_IDO_OSZLOP( $columns ) {
$new_columns = ( is_array( $columns ) ) ? $columns : array();
unset( $new_columns[ 'order_actions' ] );
$new_columns['RENDELES_DATUMA_ES_IDO'] = 'Rendelés dátuma';