New Landing How can we help? Themeforest Theme Support Dante how to extend meta-box.php

Viewing 7 posts - 1 through 7 (of 7 total)
  • Posted in: Dante
  • #119329
    tomazt
    Member
    Post count: 7

    hi
    is it possible to extend meta-boxes.php in child theme on safe way? i have some custom content for which i need meta options functionality. if i add that content types to $meta_boxes[] in meta-boxes.php it works but i don’t want to edit main theme. i want to made that changes in child theme that theme can be updateable.
    thank you

    #119400
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Hi,
    You can remove this hook following hook

    add_action( 'admin_init', 'sf_register_meta_boxes' );

    by removing it in the child theme

    remove_action( 'admin_init', 'sf_register_meta_boxes' );

    and adding a new function to register the meta boxes something like:
    add_action( 'admin_init', 'sf_custom_register_meta_boxes' );

    Then you just need to implement this function based on the existing code.

    Hope it helps.

    -Rui

    #119430
    tomazt
    Member
    Post count: 7

    hi
    thank you for answer but that not helps.
    think that i found what is a problem. path to swift framework is already defined in dante theme and cannot be changed in child theme.

    these lines in functions.php from dante theme should be somehow rewriten in child theme:

    	define('SF_TEMPLATE_PATH', get_template_directory());
    	define('SF_INCLUDES_PATH', SF_TEMPLATE_PATH . '/includes');
    	define('SF_FRAMEWORK_PATH', SF_TEMPLATE_PATH . '/swift-framework');
    	define('SF_WIDGETS_PATH', SF_INCLUDES_PATH . '/widgets');
    	define('SF_LOCAL_PATH', get_template_directory_uri());

    do you have any suggestion?

    #119616
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Hi

    I will forward this to the developer, not sure if it’s possible with some files such as the meta boxes file, however the developer may have a solution

    – Kyle

    #119847
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Hi,

    Didn’t explain further my idea when provided you that code.

    The function sf_register_meta_boxes create an instance of the class RW_Meta_Box that receives the array $meta_boxes as parameter.

    function sf_register_meta_boxes()
    	{
    		global $meta_boxes;
    	
    		// Make sure there's no errors when the plugin is deactivated or during upgrade
    		if ( class_exists( 'RW_Meta_Box' ) )
    		{
    			foreach ( $meta_boxes as $meta_box )
    			{
    				new RW_Meta_Box( $meta_box );
    			}
    		}
    	}
    	

    My idea was to remove this functionality with the remove_action, and create a new function that will use a new array that you fill has desired.

    So the idea is to create a new function passing has parameter a new array $new_meta_boxes that could be filled inside the functions.php or any other file you just need to include it in the functions.php

    Those paths above won’t work in the child theme, if you need to use then in the child theme you have to use get_stylesheet_directory() instead of get_template_directory()
    and use get_stylesheet_directory_uri() instead of get_template_directory_uri()

    -Rui

    #121221
    tomazt
    Member
    Post count: 7

    thank you rui

    #121324
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Great, thanks Rui

    – Kyle

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register