Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    You just need to create an empty plugin that is PHP file with only the plugin headers (for example)

    <?php
    /* Plugin Name: WPAdverts Addon
    Description: My addon description.
    Version: 1.0
    Author: Me
    License: GPLv2 or later
    */

    and paste custom code there, this is explained in tutorials available online
    http://www.hongkiat.com/blog/beginners-guide-to-wordpress-plugin-development/
    http://www.1stwebdesigner.com/wordpress-plugin-development-course-designers-1/

    Thread Starter bevyme

    (@bevyme)

    Thank you Greg,

    I guess i will have to take a look on everything i’ve changed so far.

    Can we copy php codes that are from wpadverts/templates/…
    And also copy php codes that are from wpadverts/includes/…

    And will both work togheter in the same file “php” we made?

    Plugin Author Greg Winiarski

    (@gwin)

    If you copy function from wpadvers/includes and paste them into your files then this will trigger Fatal Error.

    Thread Starter bevyme

    (@bevyme)

    So you saying the only one i will not copy or duplicate is functions.php?

    One last question… Do i need to rename my php file the same as te original file or can i change it to my custom php?

    Plugin Author Greg Winiarski

    (@gwin)

    I am saying not to copy functions inside WPAdverts files into your plugin/theme.

    I am also not sure why are you even coping the code the plugin will not use your files unless you will unregister original Adverts filters/action and replace them with yours, but this not require coping the files.

    Thread Starter bevyme

    (@bevyme)

    Can you give a simple example please?

    Plugin Author Greg Winiarski

    (@gwin)

    Sorry, but this is a place to get plugin support, not a place where i teach programming or how to develop WordPress plugins.

    Thread Starter bevyme

    (@bevyme)

    I got it already.

    Wasnt easier to say in regard about the wpadverts functions.php just:
    “You DO NEED to put it in your THEME functions.php or it will trigger fatal error if you clone it or if you copy the header”
    Or something like that…

    Is this the way to do it, right?

    Plugin Author Greg Winiarski

    (@gwin)

    It’s actually not about the functions.php file, this is true to any function, if you duplicate function name (regardless of whatever this is a WP, WPAdverts or some other function) it will cause a fatal error.

    BTW. Which function are you looking to replace?

    Thread Starter bevyme

    (@bevyme)

    I just want to put the codes you teach in the forum where they are safe from future updates…

    But i already figured that out.

    Plugin Author Greg Winiarski

    (@gwin)

    Ok, i am closing the thread then.

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Where to put codes’ is closed to new replies.