This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: My Plugin Name | |
* Description: Create a robust admin settings page for your WordPress plugin in minutes! More than 20 HTML5 input types are supported, including clickable labels, input hints, and even beautiful tooltips. Simply define your needed sections and inputs – everything else is automatic. Your settings are displayed with tabbed navigation that looks exactly like WordPress built it – no wonky styles, no silly cartoon characters, no in-your-face nags. The CSS totals less than 50 lines and the Javascript is less 25. This is built entirely inline with WordPress core standards and has no outside dependencies. The interface loads super-fast – you can even navigate across sections/tabs, changing settings along the way, and then click “Save” just once to save all the settings at once. Because I love you. But, you know, just as friends. | |
* Version: 1.0.0 | |
* Author: John Alarcon | |
* Author URI: https://github.com/johnalarcon/my-plugin-name | |
* Text Domain: my-plugin-name | |
* Domain Pat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Remove support for files of type doc, docx, docm, dotx, and dotm from the | |
* WordPress Media Uploader. Place this code into your theme's functions.php file. | |
*/ | |
add_filter('upload_mimes', 'jalarcon_remove_filetypes', 1, 1); | |
function jalarcon_remove_filetypes($filetypes) { | |
unset($filetypes['doc']); | |
unset($filetypes['docx']); | |
unset($filetypes['docm']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$dir = 'C:/xampp/htdocs/wordpress/wp-content/plugins/my-plugin-name/'; | |
echo get_code_size($dir); | |
function get_code_size($dir) { | |
// The directory to scan; include trailing slash. | |
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::CHILD_FIRST); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('admin_menu', 'change_admin_menu_for_editors'); | |
function change_admin_menu_for_editors() { | |
global $menu; | |
global $submenu; | |
// Update labels for Posts menu items. | |
$menu[5][0] = __('Blog Articles', 'my-text-domain'); | |
$submenu['edit.php'][5][0] = __('All Articles', 'my-text-domain'); | |
$submenu['edit.php'][10][0] = __('Add New Article', 'my-text-domain'); | |
$submenu['edit.php'][15][0] = __('Blog Categories', 'my-text-domain'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Declare the namespace. | |
namespace MYPLUGINNAME; | |
// Prevent direct access. | |
if (!defined('ABSPATH')) { | |
die(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add the following to your functions.php file to hide the WP 5.0 update nag. | |
add_action('after_setup_theme', 'codepotent_remove_wp50_update_nag'); | |
function codepotent_remove_wp50_update_nag() { | |
add_filter('pre_option_update_core','__return_null'); | |
add_filter('pre_site_transient_update_core','__return_null'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Autoload classes | |
* | |
* Autoloaded classes? Yes. Support for namespaces, too? Of course! It helps | |
* to have a good understanding of how this autoloader works, so you can use | |
* it to your benefit, and not as a reason to pull out your hair. ;) Classes | |
* do not have to be namespaced, but it is recommended they are, for maximum | |
* plays-well-with-others...ness. Let's start with the super-basics... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Prevent username enumeration via REST API | |
* | |
* This function allows normal (anonymous) access to the REST API, but makes | |
* sure that site usernames are not exposed through it. This code can be added | |
* to your theme's functions.php file. | |
* | |
* Note: there has been a report that this code may interfere with JetPack's operation. | |
* See https://twitter.com/PrysmcatBooks/status/1082022370817261568 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Code Potent's official .htaccess directives to make your ClassicPress site ROCK! | |
# Prevent directory browsing. | |
Options -Indexes | |
# Enable rewrite engine - you may already have these 2 lines... don't duplicate, if so. | |
RewriteEngine On | |
RewriteBase / | |
# Force SSL connection to everything (URLs, images, scripts, styles, etc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Change text used for display names in feeds. Default set by plugin is your site's name. | |
add_filter('codepotent_username_protection_feeds', 'codepotent_feeds'); | |
function codepotent_feeds($display_name) { | |
return $display_name; | |
} | |
// Change the REST API error message. Default set by plugin is "authentication required". | |
add_filter('codepotent_username_protection_rest_error', 'codepotent_rest_error'); |
OlderNewer