Skip to content

Instantly share code, notes, and snippets.

View ckaklamanos's full-sized avatar

Haris Kaklamanos ckaklamanos

View GitHub Profile
@ckaklamanos
ckaklamanos / hide_notify_register_from_new_user_form.php
Created January 25, 2020 13:40
Hide "Send the new user an email about their account."
add_action( 'user_new_form', 'fn_hide_notify_register_from_new_user_form' );
function fn_hide_notify_register_from_new_user_form() {
echo '<script>jQuery(document).ready(function($) {
$(".user-new-php #send_user_notification").closest("tr").hide();
} ); </script>';
}
@ckaklamanos
ckaklamanos / remove_wordpress_dashboard_widgets.php
Created January 25, 2020 12:55
Remove WordPress Dashboard Widgets (for non-Administrators)
<?php
function fn_remove_dashboard_widgets() {
global $wp_meta_boxes;
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);
@ckaklamanos
ckaklamanos / gist:c7404a64958afea013b1fd88520b97bc
Last active June 2, 2020 12:43
CS-Cart MySQL find duplicate product codes
SELECT `product_code`, COUNT(*) c FROM [prefix]_products GROUP BY `product_code` HAVING c > 1
#Show product names
SELECT a.product_code,a.status,b.product
FROM xxx_products AS a
LEFT JOIN xxx_product_descriptions AS b
ON a.product_id= b.product_id
WHERE a.product_code
IN (SELECT product_code FROM xxx_products GROUP BY product_code HAVING COUNT(product_code) > 1)
@ckaklamanos
ckaklamanos / customize_wp_login_page.php
Last active January 25, 2020 12:46
Customize wp-login.php page
class Customize_WP_Login_Page
{
public function run()
{
add_action('login_enqueue_scripts', array( $this, 'login_enqueue_scripts' ));
add_action('login_title', array( $this, 'replace_login_title' ));
add_action('login_headerurl', array( $this, 'replace_login_headerurl' ));
add_action('login_headertitle', array( $this, 'replace_login_headertitle' ));
}
@ckaklamanos
ckaklamanos / gist:470f3fdc166b11db1323
Last active November 11, 2015 10:34
Wordpress wp-config custom
define('AUTOSAVE_INTERVAL', 300 ); // seconds
define('WP_POST_REVISIONS', false );
define( 'WPCF7_ADMIN_READ_CAPABILITY', 'manage_options' );
define( 'WPCF7_ADMIN_READ_WRITE_CAPABILITY', 'manage_options' );
define('DISALLOW_FILE_EDIT', TRUE);
@ckaklamanos
ckaklamanos / gist:5b9c25311bb9f12f0d29
Last active October 17, 2015 08:58
Wordpress Better page management
// Add excerpt to pages
add_action( 'init', 'custom_add_excerpts_to_pages' );
function custom_add_excerpts_to_pages() {
add_post_type_support( 'page', 'excerpt' );
}
/*
Add Page Order column to Pages List Admin page
*/
add_filter('manage_pages_columns', 'custom_columns');
@ckaklamanos
ckaklamanos / gist:2bcee861864b77c72477
Last active September 5, 2017 08:04
Wordpress white label / custom branding
// Put this in child theme's function.php
// Upload the logo to /imahes folder of child theme
// Logo must be 80 x 80 or apply custom CSS
// custom admin login logo
function custom_login_logo() {
echo '<style type="text/css">
h1 a {
background-image: url(wp-content/themes/'.get_stylesheet().'/images/logo.png) !important;
width:186px!important;
background-size: 186px 65px!important;
@ckaklamanos
ckaklamanos / gist:448984aadd5897e2a8fc
Created October 11, 2015 18:23
CS Cart .gitignore for Addon development
# -----------------------------------------------------------------
# .gitignore for CS Cart theme and addon development
#
# By default all files are ignored. You'll need to whitelist
# any addons, folders, files you want to include in the repo.
#
# To ignore uncommitted changes in a file that is already tracked, use
# git update-index --assume-unchanged
#
# To stop tracking a file that is currently tracked, use
@ckaklamanos
ckaklamanos / gist:a9d6a7d8caa655d5ac8c
Last active October 8, 2015 12:08
Wordpress Custom Post Type: Add Order column in admin list page
add_filter('manage_$post_type_posts_columns', 'set_$post_type_columns');
function set_$post_type_columns($columns) {
$columns['order'] = 'Order';
return $columns;
}
add_action('manage_$post_type_posts_custom_column', 'set_$post_type_show_columns');
function set_$post_type_show_columns($name) {
global $post;
switch ($name) {
case 'order':
@ckaklamanos
ckaklamanos / .gitignore
Created October 2, 2015 06:19 — forked from salcode/.gitignore
WordPress .gitignore - this is my preferred gitignore file when working with WordPress. It ignores almost all files by default.
# -----------------------------------------------------------------
# .gitignore for WordPress @salcode
# ver 20150227
#
# From the root of your project run
# curl -O https://gist.githubusercontent.com/salcode/b515f520d3f8207ecd04/raw/.gitignore
# to download this file
#
# By default all files are ignored. You'll need to whitelist
# any mu-plugins, plugins, or themes you want to include in the repo.