+92 308 5039935
Get a Free Quote
+92 308 5039935

How to Auto Load Files in WordPress?

How to Auto Load Files in WordPress?

You may need to auto load files in WordPress themes or plugins. But I wouldn’t recommend it if you are creating theme to sell on themeforest. They didn’t accepted themes with this auto load function few years ago when we used to sell themes on it. Here is the function to auto load or require files.

Now if you want to auto load .php files from includes folder in a theme you will use it as following.

 

If you need to exclude a certain file like say index.php from that folder, you just need one extra line inside foreach to check if the file name is index.php then tell it to continue; to other file.

 

Hello, I am a web designer and developer working since 2013. I build WordPress themes, write and extend WordPress plugins, edit WordPress themes and plugins in accordance to customer needs and play games when free ;-)
Related Post
How to create WordPress plugin

Plugins are used to extend WordPress functionality or add a new feature. There are more than 54K+ plugins available free at WordPress Plugins directory and tons are available at other markets places.

Read more
Introduction to Websites & WordPress

School of Entrepreneurship and XeCreators collaboratively arranged a one-day workshop on “Introduction to Websites and WordPress” specially for people with no IT background.

Read more
How to Increase the Maximum File Upload Size in WordPress

There comes a time when you need to upload a larger size file but the default file upload size limit is low as 2mb. You can increase WordPress file upload size limit either by your self or contact your hosting provider to do it for you.

Read more
Post has 6 comments
  • Ignacio Mojica Posted February 16, 2020 in 8:27 am Reply

    Great content! Super high-quality! Keep it up! 🙂

  • Kathryn Perkins Posted January 29, 2020 in 6:11 am Reply

    Awesome post! Keep up the great work! 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *