• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here: Home » WordPress Plugin to Avoid Snippet on Theme’s functions.php

By Abhishek Ghosh May 28, 2016 1:18 am Updated on May 28, 2016

WordPress Plugin to Avoid Snippet on Theme’s functions.php

Advertisement

As all know, adding snippet on Theme’s functions.php or Child Theme’s functions.php is not good. Here is a WordPress Plugin to Avoid Snippet on Theme’s functions.php. In this new version you can drop the snippets as PHP files from SFTP. In Our Previous Article and Release of Previous Version We Discussed Why That is Bad.

 

WordPress Plugin to Avoid Snippet on Theme’s functions.php

 

First read the previous guide and understand how that old version worked. We have WordPress Template for Plugins. In my GitHub repo, you will get all kind of templates.

This current one has added one PHP function. We have a subdirectory inside the plugin named snippets. With PHP function, we are fetching the php files from that :

Advertisement

---

Vim
1
2
3
4
foreach (glob("snippets/*.php") as $filename)
{
    include $filename;
}

Here is the Plugin on GitHub repo, you can download and install it.

Previously, as example if you were following this guide to remove WordPress post image linking, you were adding this kind of snippet :

Vim
1
2
3
4
5
6
7
8
9
10
11
function k99_image_link_void( $content ) {
    $content =
        preg_replace(
            array('{<a(.*?)(wp-att|wp-content\/uploads)[^>]*><img}',
                '{ wp-image-[0-9]*" /></a>}'),
            array('<img','" />'),
            $content
        );
    return $content;
}
add_filter( 'the_content', 'k99_image_link_void' );

With this plugin, you can save this snippet as PHP file with a meaningful name like remove-image-link.php and directly drop inside the /snippets/ directory of the plugin.

Instead of using :

Vim
1
include dirname(__FILE__)."/example.php";

we are fetching all the files from the snippets directory. Many use this in WordPress development :

Vim
1
include "./common.php";

like lines. That most likely to fail when the script is invoking include when it is actually being included by another script in another directory. Our snippet is slightly different. It will avoid to load one single PHP when it has dependency on other files. It is tricky usage to avoid collision. We have lot of such useful WordPress snippets.

Those who are new WordPress users, they should not use that method. They should activate the Plugin. Go to Plugins > Editor and select our Plugin. Thereafter select the included default.php file inside snippets directory. Then paste the PHP code, and save the file. That is shown in this screenshot :

WordPress Plugin to Avoid Snippet on Theme’s functions-php

Here is the full size image.

 

Report Bug Against This WordPress Plugin to Avoid Snippet on Theme’s functions.php

 

So far, we have no target to make the plugin available in WordPress Repo. When we develop for official repo, we have to add more lines for near perfect coding. Our FTP to Zip WordPress Backup Plugin. There are newbie “white hackers”. They open security issue without reading the details. It is for helping to somehow rescue from a bad shared host. It is a wastage of time to argue and show point. Many developers are keeping advanced plugins in GitHub or own server. Additionally SVN (which WordPress uses) is a painful system to update. SVN via Git has problems too.

This Article Has Been Shared 801 Times!

Facebook Twitter Pinterest
Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to WordPress Plugin to Avoid Snippet on Theme’s functions.php

  • Taxonomy in WordPress : how to use WordPress Taxomonies effectively

    Taxonomies in Wordpress can be used to arrange, classify and group post. Learn how you can use Taxomomies in Wordpress effectively.

  • Best AdSense Ad Code Injector Plugin For WordPress : Ad Injection

    Best AdSense Ad Code Injector Plugin For WordPress currently available is Ad Injector. This plugin can help for logical category wise custom ad unit injection.

  • List of Open Source PHP MySQL Based Blogging Softwares

    List of Open Source PHP MySQL Based Blogging Softwares lists the most commonly used and available softwares those can run on any LAMP server easily.

  • YouTube Tips : Embed Playlist, YouTube’s audio, YouTube HTML5 Player

    Here are YouTube Tips to Embed YouTube Playlist, YouTube’s audio, YouTube HTML5 Player in any webpage or WordPress page or posts. Let us see how we can do them.

  • TechArticle schema : Implementing in WordPress

    TechArticle schema is a specification described under Article, which is under CreativeWork, which is under Thing. Here is how to implement TechArticle schema.

Additionally, performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (22.1K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • How Artificial Intelligence (AI) Is Changing The Way We Play Bingo May 16, 2022
  • Why You Need A Big Data Consultant May 15, 2022
  • The Connection Between AI And Online Slots May 13, 2022
  • How To Choose Your Niche As An Instagram Influencer May 12, 2022
  • How to Choose a Powerful Domain Name for Your New Venture May 12, 2022

About This Article

Cite this article as: Abhishek Ghosh, "WordPress Plugin to Avoid Snippet on Theme’s functions.php," in The Customize Windows, May 28, 2016, May 17, 2022, https://thecustomizewindows.com/2016/05/wordpress-plugin-to-avoid-snippet-on-themes-functions-php/.

Source:The Customize Windows, JiMA.in

This website uses cookies. If you do not want to allow us to use cookies and/or non-personalized Ads, kindly clear browser cookies after closing this webpage.

Read Privacy Policy.

PC users can consult Corrine Chorney for Security.

Want to know more about us? Read Notability and Mentions & Our Setup.

Copyright © 2022 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy