Adding WP child theme support to 6.1.6

Discussion in 'Integration' started by spaamfaawebmaster, Dec 12, 2019.

  1. spaamfaawebmaster

    spaamfaawebmaster aMember Pro Customer

    Joined:
    Feb 13, 2011
    Messages:
    3
    amember/application/default/plugins/protect/wordpress/wordpress.php Line 622

    changed:
    PHP:
    $path defined("TEMPLATEPATH") ? basename(TEMPLATEPATH) : 'default';
    To:
    PHP:
    $path $this->getWpThemepath();
    Added outside setupWpThemeViewPath():
    PHP:
    protected function getWpThemepath() {
            
    $dir is_child_theme() ? get_stylesheet_directory() : get_template_directory();
            if ( 
    '' !== $dir ) {
                return 
    basename$dir );
            }
            return 
    'default';
        }
    This has the added bonus of getting rid of the deprecated call to TEMPLATEPATH. This is rather hacky. It loses the advantage of the constant not being defined being a simple test. I put the test of '' !==$dir in place of whatever tests you need to perform to ensure that you can call is_child_theme(), get_stylesheet_directory(), and get_template_directory().
  2. spaamfaawebmaster

    spaamfaawebmaster aMember Pro Customer

    Joined:
    Feb 13, 2011
    Messages:
    3
    This should protect it:

    PHP:
    protected function getWpThemepath() {
            if ( 
    function_exists'is_child_theme' ) && function_exists'get_stylesheet_directory' ) && function_exists'get_template_directory' ) ) {
                return 
    basenameis_child_theme() ? get_stylesheet_directory() : get_template_directory() );
            } elseif ( 
    defined'TEMPLATEPATH' ) ) {
                return 
    basenameTEMPLATEPATH );
            }
            return 
    'default';
        }

Share This Page