WordPress.org

Ready to get started?Download WordPress

Forums

Confused on how to include a Custom Post Type file into a Child Theme (1 post)

  1. rocboy001
    Member
    Posted 2 years ago #

    Hey Guys,

    I'm working in a child theme and am trying to include a custom post type file into the functions.php

    Here is what I have been trying, but to no avail:

    function agility_child_setup() {
    	global $agilitySettings;
    	$GLOBALS['cpt_service'] = new ServicePostType();
    	$GLOBALS['cpt_special'] = new SpecialPostType();
    }
    add_action( 'after_setup_theme', 'agility_child_setup' );
    
    function agility_child_load_module( $module , $rootFile='' ){
    	if( $rootFile == '' ) $rootFile = $module;
    	require_once( "modules/$module/$rootFile.php" );
    }
    
    function agility_child_load_modules(){
    	agility_child_load_module( 'service' );
    	agility_child_load_module( 'special' );
    }

    The "Service" and other custom post type files are in there seperate folders located at child-theme/modules/customposttype/customposttype.php

    Any help would definitely be appreciated.

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic