I can always find some class contains theme_setup methods like below, but I never see this methods been called. I don't what's this method for.

  final class InfiniteScroll extends Package {

    protected static $single_instance = null;

    public static function theme_setup() {
        $is = self::get_instance();

        add_action( 'wp_enqueue_scripts', array($is, 'infinite_scroll_js') );

     * AJAX Function for infinite scroll
    public function infinite_scroll() {
        ...some implement....

     * Register js for Infinite Scroll
    public function infinite_scroll_js() {
        ...some code here...
  • 1
    theme initialisation, pretty sure it's called somewhere, you just have not found it – inarilo Nov 17 '17 at 22:38

Methods in 3rd party plugin and theme classes can be called whatever the author wants them to be called. theme_setup() doesn't mean anything special, and doesn't even necessarily mean the same thing in different plugins.

And since it's not a special method to WordPress, they're never going to be called automatically by WordPress, so the plugin would be calling them somewhere, you just haven't found it. If I had to guess, theme_setup() is a logical name for a method that might be being hooked to after_theme_setup, but there's no guarantee.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.