Results 1 to 2 of 2

Thread: Overriding the vantage theme 'includes'

  1. #1
    Thread Starter
    Junior Member wishie's Avatar
    Join Date
    Jan 2014
    Location
    Australia
    Posts
    48
    Thanks
    0
    Thanked 1 Time in 1 Post

    Overriding the vantage theme 'includes'

    Hi all,

    So like any good Wordpress 'developer' I have created a child theme 'apothems-vantage-child' and it works fine for the most part, except when trying to override theme files in the /includes/ folder of the theme.
    Now, on the Wordpress codex there is information on how to normally do this:

    Code:
    require_once( get_stylesheet_directory(). '/includes/customizedfile.php' );
    inside your child themes functions.php file.. But in the case of Vantage, this does not work, instead causing the theme/site to stop working.

    In my case, I am trying to make changes to /includes/listings/class-business-listing-builder.php to add
    Code:
    'show_in_rest' => true
    to the register_post_type() so that 'listing' is a valid endpoint in the WP-JSON API.

    I believe the problem with my overriding it stems from how the parent theme loads the files in question. It seems to use the following:

    Code:
    appthemes_load_files( dirname( __FILE__ ) . '/', array(
            'class-business-listing-builder.php',
            'class-business-listing-caps.php',
            'class-business-listing-form.php',
            'class-business-listing-geocode.php',
    
            // TODO: remove following classes since they just added for smooth
            // transition from Vantage classes to Listing module classes.
            'class-business-listing-process-new.php',
            'class-business-listing-process-renew.php',
            'class-business-listing-process-edit.php',
            'class-business-listing-step-edit-info.php',
    ) );
    utilising appthemes_load_files instead of a more traditional 'include' or 'require'.

    My question is, is there an easier way to make the 'listing' post type appear in the WP-JSON API, or do I have to keep editing the main Vantage files after every update?
    Or, perhaps the Vantage devs can add an option to expose the data via the API?

    - - - Updated - - -

    On closer inspection, I see that "appthemes_load_files" is defined like this:

    Code:
    function appthemes_load_files( $path, $files = array() ) {
            foreach ( $files as $file_path ) {
                    require_once $path . $file_path;
            }
    }
    so the require_once would be causing the issue I believe.

  2. #2
    Thread Starter
    Junior Member wishie's Avatar
    Join Date
    Jan 2014
    Location
    Australia
    Posts
    48
    Thanks
    0
    Thanked 1 Time in 1 Post
    You must be an AppThemes customer and logged in to view this response. Join today!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Vantage child theme - how to include a '/includes/' folder
    By wbron69 in forum Help Using Vantage (Legacy)
    Replies: 1
    Last Post: October 20th, 2016, 12:10 PM
  2. Overriding files in includes folder
    By jmak in forum Help Using HireBee
    Replies: 3
    Last Post: September 15th, 2015, 04:06 PM
  3. overriding email functions in includes/emails.php
    By almightyeric in forum ClassiPress General Discussion
    Replies: 4
    Last Post: February 8th, 2014, 03:20 AM
  4. \vantage\includes\template-tags.php & Child-Theme?
    By luxor in forum Vantage General Discussion (Legacy)
    Replies: 9
    Last Post: March 26th, 2013, 01:25 AM
  5. How do I modify Vantage Child Theme files in the '/includes' folder?
    By mhunt in forum Vantage General Discussion (Legacy)
    Replies: 17
    Last Post: September 17th, 2012, 07:19 PM