Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

TrueQAP trueqap

🎯
Focusing
View GitHub Profile
@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');
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 / 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';
@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 / woocommerce_add_order_page_date_and_time.php
Created Jan 28, 2018
Modify the WooCommerce order date column with time (date + time)
View woocommerce_add_order_page_date_and_time.php
<?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 Jan 31, 2018
WordPress admin mappa átnevezése
View admin.php
<?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 Jan 31, 2018
Wp-admin -> beallitasok
View .htaccess
<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]
View 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>'
);
View 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>
You can’t perform that action at this time.