by Garth | Mar 14, 2021 | PHP , Wordpress
function TRIM_ADMIN_MENU() {
global $current_user;
if(!current_user_can('administrator')) {
remove_menu_page( 'tools.php' ); // No tools for <= editors
remove_menu_page( 'activity_log_page' ); // Activity log
}
}
add_action('admin_init', 'TRIM_ADMIN_MENU');
by Garth | Mar 14, 2021 | PHP , Wordpress
if( !function_exists( 'plugin_prefix_unregister_post_type' ) ) {
function plugin_prefix_unregister_post_type(){
unregister_post_type( 'project' );
}
}
add_action('init','plugin_prefix_unregister_post_type');
by Garth | Mar 14, 2021 | PHP , Wordpress
function remove_default_post_type() {
remove_menu_page( 'edit.php' );
}
add_action( 'admin_menu', 'remove_default_post_type' );
by Garth | Mar 2, 2021 | PHP , Wordpress
function create_posttype() {
register_post_type( 'wpll_product',
array(
'labels' => array(
'name' => __( 'Videos' ),
'singular_name' => __( 'Video' )
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'videos'),
)
);
}
add_action( 'init', 'create_posttype' );
by Garth | Nov 26, 2020 | CSS
a {pointer-events: none;}
by Garth | Nov 24, 2020 | Javascript
INTRO JS
https://introjs.com/example/hello-world/index.html
Wizard steps are managed with simple HTML attributes
data-step="1" data-intro="This is a tooltip for wizard step 1!" data-step="2" data-intro="This is the second tooltip for wizard step 2!" data-step="3" data-intro="This is the third tooltip for wizard step 3!"
The below script needs to be added to
$(document).on('click', '#wizard', function(e) {
e.preventDefault();
introJs().start();
});
by Garth | Nov 9, 2020 | Javascript
In the Ajax submits you will see a variable. formdata The below snippet is what you must append to the top of your Ajax call to initiate the variable Otherwise you need to change the variable to what ever you are targeting.
var formdata = new FormData;
formdata.append("commId", $("#template-id").val());
$("#product-form").on('submit', function(e) {
e.preventDefault();
$.ajax({
type: 'POST',
url: 'strategy/create-product',
data: new FormData(this),
contentType: false,
dataType: 'json',
cache: false,
processData: false,
success: function(response) {
if (response.success) {
location.href = "product/index"
} else {
PNotify.error({
title: 'Error Saving Product',
text: response.message,
mode: 'light'
});
}
}
});
});
$.ajax({
type: 'POST',
url: 'products/save-email-template',
dataType: 'json',
data: formdata,
processData: false,
cache: false,
contentType: false,
success: function (response) {
if (response.success) {
PNotify.success({
title: 'Success!',
text: response.message,
styling: 'material',
mode: 'light',
maxTextHeight: null,
delay: 2000,
destroy: true,
closer: true,
sticker: false
});
setTimeout(() => {
location.reload();
}, 500);
} else {
PNotify.error({
title: 'Error!',
text: response.message,
styling: 'material',
mode: 'light',
maxTextHeight: null,
delay: 2000,
destroy: true,
closer: true,
sticker: false
});
}
}
});
by Garth | Nov 4, 2020 | Plugins
If you get locked out of your website with this plugin you can clean your table for this plugin to reset it so you can reconfigure it with the below query.
SELECT * FROM wp_options WHERE option_name="aio_wp_security_configs"
by Garth | Nov 2, 2020 | htaccess , Wordpress
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} ^page_id=([0-9]*)&category=(.*)$
RewriteRule ^(.*)$ /%1/%2? [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
by Garth | Oct 22, 2020 | Minc Framework
https://github.com/MincDev/php-mysql-connector
MVC
Model - Handles all DB calls View - Handles all front end Controller - Calls Model functions for DB transactions