Adding functionality to a wordpress plugin

This is a simple concept question… If I have a wordpress plugin and I want to write some functions for my own IN ADDITION to what they have already where would I put them in the wordpress file structure?

I cant put them in the original core.php files/directory because they will get wiped out when the plugins are updated right?

Read More

@NomikOS – Yeah Sure .. I have a wordpress plugin called BP-Phototag- pretty much an album..Its located in the wp-content/plugins folder. I want to add my own functions…for a specific template in my themes folder. DO i put the functions in the bpa.core.php file in the wp-conten/plugins folder or do I make a new php file that can inherit bpa.core.php functions(which I dont know how to do) and stick them in my template specific folder under wp-content/themes/mytheme folder. Im really not sure how to extend and override it…

Related posts

Leave a Reply

1 comment

  1. If the plugin is class based, you can extend it to override/add methods. You can include the file containing your code inside plugin’s directory if you want (it will not deleted after an upgrade) or directly inside plugins dir.

    EDIT 1

    Sorry, I didn’t saw your last comment. Well, my friend, it’s time to learn OOP PHP5. I recommend you PHP 5 objects, patterns, and practice. It’s for PHP serious coders.

    Basically you do

    class leon_my_class extends BP_Phototag_class {
    
        function __construct()
        {
            parent::__construct();
    
            // my code
        }
    
        // overriding protected/public method 
        function BP_Phototag_method()
        {
            // this code will replace original code
        }
    
        // adding method
        function my_own_method()
        {
    
        }
    
    }