This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Using theme options to set image sizes

  • Creator
    Topic
  • #10263
    John
    Participant

    I have been using custom theme options to set image sizes. In the new framework my old code doesn’t work. Presumably the filter is running at the wrong time.

    function jma_get_theme_values() {
    	$jma_option_name = themeblvd_get_option_name();
    	$jma_spec_options = get_option($jma_option_name);
    	return $jma_spec_options;
    }
    
    **
     * Slider image sizes
     */
    function jma_slider_image_sizes( $sizes ) {
    	$jma_spec_options = jma_get_theme_values();
    
        // image size for header slider
        $sizes['jma-home-header']['width'] = $jma_spec_options['header_image_width'];
        $sizes['jma-home-header']['height'] = $jma_spec_options['header_image_height'];
        $sizes['jma-home-header']['crop'] = true;
        return $sizes;
    }
    add_filter( 'themeblvd_image_sizes', 'jma_slider_image_sizes' );
    
    function jma_add_options() {
    	require_once ( 'jma-options-header.php' );// file that creates special options tab
    }
    add_action( 'after_setup_theme', 'jma_add_options', 1);

    thx
    john

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #10269
    Jason Bobich
    Keymaster

    The problem on this one is that the themeblvd_get_option_name() is not pulling anything at this point, any more. I talked to another person that had this issue from a customization they were doing and so I’ve re-worked things a bit for the next update to ensure that themeblvd_get_option_name() can be used anywhere in the Child theme after the framework is run.

    So, I guess the quick fix here temporarily would just be to replace themeblvd_get_option_name() with the actual option name string, which will be the name of your current theme in lower case letters, no spaces — i.e. “My Cool Theme” would be “mycooltheme”

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.