WordPress plugin: Create a plugin just for your site

WordPress CMS plugins (from the content management system), or plugins, offer you additional functions, or security, depending on the plugin you use on your wordpress site.

Below we will see a plugin made only for WordPress of iGuRu.gr. Of course, as long as I publish it, you are free to modify it and use it on your own website, and for your own needs. WordPress

Below we will see the code and I will try to explain each functionality. You can add or remove pieces depending on your needs. At the end of the post there is also the folder with the php file that you need to upload and activate in the dir that contains your plugins.

WordPress iGuRu Plugin Explanations:

1. hAtom: is a template of microformats.org. Helps in SEO. Using the template below is not visible on the site, but adds hAtom tags to your page.
2. Custom Search: Genesis Themes only. The code below presupposes the creation of a custom search engine on google, and creating a special page (iguru-google-search) that will contain the code of the custom search engine you created.
3. Comments: The following code concerns the comments of the Genesis Framework. If you want to convert it to your own non-Genesis theme, change the parameters of genesis_title_comments and genesis_after_comments to those used by your theme.
4. devicepx: Get rid of devicepx (only if you use Jetpack), it slows down your site.
5. Avatar: use a custom avatar for everyone. Select the image and upload it to dir images named gravatar.png
6. Query Strings: remove all; from the URLs of your script.
7. Admin footer text Add your own text at the bottom of the admin panel.
8. Autoptimize cache: automatically delete the cached files of autoptimize as soon as their size exceeds 512MB.

Let's look at the code

< ?php /* *Plugin Name: Site Plugin for iGuRu.gr * Plugin URI: https://iguru.gr * Description: Site custom code changes for iGuRu.gr * Version: 1.0 * Author: giorgos * Author URI: https ://iguru.gr * Text Domain: iguru-plugin */ //* Add Google Custom Search to Genesis Search add_filter( 'genesis_search_form', 'giorgos_search_form', 10, 4); function giorgos_search_form( $form, $search_text, $button_text) { $onfocus = " onfocus=\"if (this.value == '$search_text') {this.value = '';}\""; $onblur = " onblur=\"if (this.value == '') {this.value = '$search_text';}\""; $form = '
'. $ label. ' '; return $ form; } // * Mod Content Giorgos function hatom_mod_post_content ($ content) {if (in_the_loop () &&! Is_page ()) {$ content = ''. $ content.''; } return $ content; } add_filter ('the_content', 'hatom_mod_post_content'); // * Add Hatom Giorgos function add_hatom_data ($ content) {$ t = get_the_modified_time ('F j, Y, g: i a'); $ author = get_the_author (); $ title = get_the_title (); if (is_singular ()) {$ content. = ''; } return $ content; } add_filter ('the_content', 'add_hatom_data'); if (! isset ($ content_width)) $ content_width = 800; add_filter ('genesis_title_comments', 'iguru_genesis_title_comments'); function iguru_genesis_title_comments () title $ title = '

Comments

'; return $ title; } add_filter ('comment_form_defaults', 'iguru_comment_submit_button'); function iguru_comment_submit_button ($ defaults) {$ defaults ['label_submit'] = __ ('Publish', 'custom'); return $ defaults; } add_filter ('comment_form_defaults', 'iguru_comment_form_defaults'); function iguru_comment_form_defaults ($ defaults) {$ defaults ['title_reply'] = __ ('Leave your comment'); return $ defaults; } add_action ('genesis_after_comments', 'iguru_comment_policy'); function iguru_comment_policy () {if (is_single () &&! is_user_logged_in () && comments_open ()) {?>

Comment Policy:

IGuRu.gr does not publish the comments immediately. Malicious comments, comments that contain ads, or comments that are offensive are deleted without notice.

We do not adopt the opinions expressed by our readers.
< ?php } } add_filter( 'genesis_comment_list_args', 'iguru_comments_gravatar' ); function iguru_comments_gravatar( $args ) { $args['avatar_size'] = 60; return $args; } add_filter( 'genesis_show_comment_date', 'iguru_remove_comment_time_and_link' ); function iguru_remove_comment_time_and_link( $comment_date ) { printf( '

', genesis_attr (' comment-meta ')); printf (''; // Return false so that the parent function does not also output the comment date and time return false; } // * iguru remove devicepx Only if you use Jetpack function remove_devicepx () {wp_dequeue_script ('devicepx'); } add_action ('wp_enqueue_scripts', 'remove_devicepx'); add_action ('admin_enqueue_scripts', 'remove_devicepx'); // * iguru Avatar defaults add your image to /images/gravatar.png add_filter ('avatar_defaults', 'giorgos_custom_gravatar'); function giorgos_custom_gravatar ($ avatar) {$ custom_avatar = get_stylesheet_directory_uri (). 'https://cdn.iguru.gr/images/gravatar.png'; $ avatar [$ custom_avatar] = "Custom Gravatar"; return $ avatar; } // * remove query strings Giorgos function _remove_script_version ($ src) {$ parts = explode ('?', $ src); return $ parts [0]; } add_filter ('script_loader_src', '_remove_script_version', 15, 1); add_filter ('style_loader_src', '_remove_script_version', 15, 1); remove_action ('genesis_before_loop', 'genesis_do_breadcrumbs'); add_action ('genesis_before_entry', 'genesis_do_breadcrumbs'); function iguru_tweaks_change_admin_footer_text ($ text) {return sprintf (__ ('Powered by WordPress | Optimized by WPress.gr',' wpo-tweaks'), 'https://WPress.gr'); } add_filter ('admin_footer_text', 'iguru_tweaks_change_admin_footer_text'); // * Clear autoptimize cache beyond 512MB Giorgos if (class_exists ('autoptimizeCache')) {$ myMaxSize = 512000; $ statArr = autoptimizeCache :: stats (); $ cacheSize = round ($ statArr [1] / 1024); if ($ cacheSize> $ myMaxSize) {autoptimizeCache :: clearall (); header ("Refresh: 0"); }

Those of you who want the plugin ready for repairs, you can download it from the following link

iguru-plugin.zip


Add Parallax scrolling effects to your website without plugins

iGuRu.gr The Best Technology Site in Greeceggns

Get the best viral stories straight into your inbox!















Written by giorgos

George still wonders what he's doing here ...

Leave a reply

Your email address is not published. Required fields are mentioned with *

Your message will not be published if:
1. Contains insulting, defamatory, racist, offensive or inappropriate comments.
2. Causes harm to minors.
3. It interferes with the privacy and individual and social rights of other users.
4. Advertises products or services or websites.
5. Contains personal information (address, phone, etc.).