Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

TrueQAP trueqap

🎯
Focusing
View GitHub Profile
View ingyenes-szallitasi-kuszob-woocommerce.php
<?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
*/
View WordPress Own Posts Only
<?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 Jan 16, 2018
WooCommerce simple or variable product
View woo_simple_or_variable.php
?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' ) ){
View functions.php
<?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 Jan 23, 2018
Delete WooCommerce products with images (attachment)
View del_woo_products_with_ attachment.php
<?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 Jan 25, 2018
Hide admin for NON-ADMIN users WordPress - Redirect non-admin users to home page
View hide_admin.php
<?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 Jul 14, 2019
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
View domain_renamer.sql
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');
View potkulcs.php
<?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 Jan 26, 2018
WooCommerce ár eltüntetése
View Hide_price_in_woocommerce.php
<?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 Jan 28, 2018
Add time and date to WooCommerce order page with new column.
View Date_time_on_WooCommerce_order_page.php
<?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';
You can’t perform that action at this time.