• Resolved mjdigital

    (@mjdigital)


    This plugin is great and there’s a lot of work gone into it so thank you for that.

    I’ve been trying to get template overrides working with a child theme and have found a few issues. First it appears that the code uses get_template_directory() which will always return the parent theme – this means you would need to put the custom templates in the parent theme directory. This is fine but the documentation should be clearer on this. In an ideal world if this could use get_stylesheet_directory() instead that would be reallyhelpful.

    The second issue is that it only appears to load the custom templates on the front end (the only place I could find it was in helper_functions.php – extensive_vc_get_module_template_part() method) so you can’t change/add parameters for the element settings. It would be really helpful if we could expand both the element settings/parameters and the front end template.

    If these issues could be resolved it would be amazing.

    If I have missed something somewhere please let me know.

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Nenad Obradovic

    (@nenad-obradovic)

    Hi mjdigital,

    Thank you 🙂

    1. Yes, you are right, this is the bug and I will fix this issue in the next plugin release. At this moment you can go into plugin folder extensive-vc/constants.php open this file and find this code below

    define( 'EXTENSIVE_VC_THEME_ROOT_PATH', get_template_directory() );

    and replace it with this

    define( 'EXTENSIVE_VC_THEME_ROOT_PATH', get_stylesheet_directory() );

    2. If I understand, you want to add additional VC options for some shortcode?

    If I’m right, you’ll have to wait a little while until I try few solutions in my side. Thanks for your patience.

    Not perfect/good solutions:
    1. For example you can try to override whole class with that shortcode, inside plugin folder you have condition if class_exist for all shortcodes, so you can be able to override whole class from different places.

    2. Also there is a hook extensive_vc_action_include_shortcodes_file where you can include your own shortcode, just create additional copy of plugin shortcode, modify it with your parameters, with your templates and set your shortcode name and you will get what you want.

    Best regards,
    Nenad

    Thread Starter mjdigital

    (@mjdigital)

    Nenad

    Thanks for the reply – for the time being I will do as you suggest and tweak the plugin core files and use the extensive_vc_action_include_shortcodes_file to insert a tweaked clone of the elements I need to update.

    Thanks again for all your time on this, it is a great plugin.

    Mark

    Plugin Author Nenad Obradovic

    (@nenad-obradovic)

    Hi mjdigital,

    You are welcome, but now I have better news 🙂

    New plugin update is arrived, just update you version of plugin and you will get additional hook extensive_vc_filter_shortcode_params to add additional shortcode parameters.

    Example functions how you can do that are

    if ( ! function_exists( 'extensive_vc_blockquote_additional_params' ) ) {
        function extensive_vc_blockquote_additional_params( $params, $shortcode_base ) {
    	if ( $shortcode_base === 'evc_blockquote' ) {
    	    $params[] = array(
    		'type'       => 'textfield',
    		'param_name' => 'some_text_field',
    		'heading'    => esc_html__( 'Some Text Field', 'extensive-vc' )
    	    );
    			
    	    return $params;
    	}
        }
    	
        add_filter( 'extensive_vc_filter_shortcode_params', 'extensive_vc_blockquote_additional_params', 10, 2 );
    }
    
    if ( ! function_exists( 'extensive_vc_set_blockquote_additional_params_default_value' ) ) {
        /**
        * @param array  $out       The output array of shortcode attributes.
        * @param array  $pairs     The supported attributes and their defaults.
        * @param array  $atts      The user defined shortcode attributes.
        * @param string $shortcode The shortcode name.
        *
        * @return array
        */
        function extensive_vc_set_blockquote_additional_params_default_value( $out, $pairs, $atts, $shortcode ) {
    	$out['some_text_field'] = '';
    		
    	return $out;
        }
    	
        add_filter( 'shortcode_atts_evc_blockquote', 'extensive_vc_set_blockquote_additional_params_default_value', 10, 4 );
    }

    I hope this helps you.

    Best regards,
    Nenad

    • This reply was modified 7 years, 11 months ago by Jan Dembowski.
    • This reply was modified 7 years, 11 months ago by Nenad Obradovic. Reason: Grammar fix
    Thread Starter mjdigital

    (@mjdigital)

    Nenad

    That’s perfect – I’ve updated the plugin and tried out the new hooks and they do exactly what I needed for this project.

    Thanks so much for getting that sorted – brilliant plugin and brilliant support. I’ll make sure to give it 5 stars for you.

    Mark

    Plugin Author Nenad Obradovic

    (@nenad-obradovic)

    Hi Mark,

    You are welcome ☺

    Thanks so much for this kind of words and for the rating. ☺

    Best regards,
    Nenad

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Template override issues’ is closed to new replies.