Skip to content

Instantly share code, notes, and snippets.

View trueqap's full-sized avatar
🎯
Focusing

TrueQAP trueqap

🎯
Focusing
View GitHub Profile
@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');
<?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 / 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';
@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 / woocommerce_add_order_page_date_and_time.php
Created January 28, 2018 07:24
Modify the WooCommerce order date column with time (date + time)
<?php
//https://woopress.hu/forumok/tema/rende/
function woocommerce_add_order_page_date_and_time($h_time)
{
return get_the_time(__('Y/m/d G:i', 'woocommerce'));
}
add_filter('woocommerce_admin_order_date_format', 'woocommerce_add_order_page_date_and_time');
@trueqap
trueqap / admin.php
Created January 31, 2018 07:06
WordPress admin mappa átnevezése
<?php
function my_custom_admin_url($path) {
return str_replace('wp-admin', 'beallitasok', $path);
}
add_filter('admin_url', 'my_custom_admin_url');
@trueqap
trueqap / .htaccess
Created January 31, 2018 07:13
Wp-admin -> beallitasok
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^beallitasok[^/]*$ beallitasok/ [R=301,L]
RewriteCond %{QUERY_STRING} (.*)$
RewriteRule ^beallitasok(.*)$ wp-admin$1? [QSA,L,NE]
RewriteCond %{QUERY_STRING} (.*)$
RewriteRule ^wp-admin/?$ / [NE,R=404,L]
RewriteCond %{QUERY_STRING} (.*)$
RewriteRule ^wp-admin/(.*)$ beallitasok/$1 [QSA,R=301,L,NE]
@trueqap
trueqap / plugin_row_meta
Created February 5, 2018 17:23
plugin_row_meta
add_filter( 'plugin_row_meta', 'custom_plugin_row_meta', 10, 2 );
function custom_plugin_row_meta( $links, $file ) {
if ( strpos( $file, 'plugin-file-name.php' ) !== false ) {
$new_links = array(
'donate' => '<a href="donation_url" target="_blank">Donate</a>',
'doc' => '<a href="doc_url" target="_blank">Documentation</a>'
);
@trueqap
trueqap / mod_gzip_on
Created February 27, 2018 09:09
mod_gzip_on
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>