Invent-Child include *.php overwrite

Support Forums for LiveMesh Themes & Plugins Forums Invent Theme Support Invent-Child include *.php overwrite

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #15899
    Vcbvcb
    Member

    Dear Dev-Team,

    after playing around with invent-child theme some questions came up.
    In detail I’d like to overwrite the thumbnail generation.

    I’ve tried to copy the following part within invent-child/functions.php file without success.
    How can I call parts within the framework/folder-structure?
    Thanks in advance.

    /**
    * Registers new thumbnails for the theme.
    *
    */
    function register_thumbs() {

    $image_sizes = $this->get_image_sizes();

    foreach (array_keys($image_sizes) as $key) {
    add_image_size($key, $image_sizes[$key][0], $image_sizes[$key][1], true);
    }

    }

    function get_image_sizes() {

    if (!isset($this->image_sizes)) {

    $this->image_sizes = array(
    // Generate NO Thumbnails
    );

    }
    return $this->image_sizes;
    }

    Further I’d like to overwrite the following framework/files too:
    framework/widgets/mo-author-widget.php
    framework/admin/shortcodes/tinymce/images/*.*
    framework/admin/tinymce/window_page.php

    I’ve also tried to get my head around your example file, without luck ;/
    Thanks for helping out on this one.
    Regards

    #15951
    RaghavendraRaghavendra
    Moderator

    Pls use the following code in functions.php of your child theme and see if that helps –

    include_once(get_template_directory() . '/framework/framework.php');
    class MO_Child_Framework extends MO_Framework {
    
            /**
         * Registers new thumbnails for the theme.
         *
         */
        function register_thumbs() {
    
            $image_sizes = $this->get_image_sizes();
    
            foreach (array_keys($image_sizes) as $key) {
                add_image_size($key, $image_sizes[$key][0], $image_sizes[$key][1], true);
            }
    
        }
        function get_image_sizes() {
    
            if (!isset($this->image_sizes)) {
    
                $this->image_sizes = array(
                    'mini-thumb' => array(90, 65),
                    'small-thumb' => array(295, 220),
                    'medium-thumb' => array(550, 400),
                    'large-thumb' => array(820, 400),
                    'slider-thumb' => array(1140, 500),
                    'square-thumb' => array(450, 450),
                    'proportional-thumb' => array(580, 0)
                );
    
            }
            return $this->image_sizes;
        }
    }
    
    $mo_theme = new MO_Child_Framework();
    

    For author widget, just copy the file/class and define your own widget instead of modifying the existing one. Changing parts of widget code is risky. You need to have an idea as to how parts work together to make the whole and defining a new widget in your child theme is the best way to go.

    Same with shortcodes. If you need to override a shortcode, better to create a new shortcode by copying the code from the parent theme and renaming the shortcode to your own. Should be easy to do since shortcodes typically have one or max two functions defined.

    Regarding tinymce, the structure of these enhancements is generally such that they are not too child theme friendly. They do not follow the general structure of a WordPress theme. Will need to give a thought how best to handle it.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Invent Theme Support’ is closed to new topics and replies.