Home Forums Basel support forum Additional social fields in administration panel in child theme

Additional social fields in administration panel in child theme

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #2483

    Mikle
    Participant

    Hello!

    I trying to add some extra social icons for my site through the Basel Child Theme.
    So, I know, how to show them in template, taking URLs links from database (via “basel_shortcode_social” function and hook in Child Theme “function.php”).

    Also I know, how to add form fields for URLs in admin panel, by rewriting “inc/settings.php”, the part of code, starting with:

        Redux::setSection( $opt_name, array(
            'title' => 'Social',
            'id' => 'social',
             ...

    BUT I only know how to rewrite this code in the PARENT theme, what is totally incorrect.

    My question: is there a way to add social URLs fields in admin panel with some code in child theme function.php?

    #2489

    Artem Temos
    Keymaster

    Hello,

    To add additional icons you just need to rewrite “basel_shortcode_social” function in the child theme. So just copy this function entirely and place into functions.php file of your child theme. Then modify this function by adding HTML code for other social icons. Unfortunately, there is no quick instructions at the moment how to add fields to the admin panel in the child theme.

    Regards

    #2499

    Mikle
    Participant

    There is a solution, but I think it is not optimal.
    Just add in your child theme functions.php file next lines.
    (Change all id, title and default params in ‘fields’ => array to appropriate for your case.)

        Redux::setSection( "basel_options", array(
            'title' => 'Social',
            'id' => 'social',
            'icon' => 'el-icon-group',
            'fields' => array (
                array (
                    'id'       => 'vk_link',
                    'type'     => 'text',
                    'title'    => __('VK link', 'basel'), 
                    'default' => '#'
                ),
                array (
                    'id'       => 'mm_link',
                    'type'     => 'text',
                    'title'    => __('MailRu link', 'basel'), 
                    'default' => '#'
                ),
                array (
                    'id'       => 'ok_link',
                    'type'     => 'text',
                    'title'    => __('Odnoklassniki link', 'basel'), 
                    'default' => '#'
                ),
            ),
        ) );

    This code adds 3 fields for socials URLs in Theme settings -> Socials before all old fields.
    It seems like it works, but, to do it right way you, probably, need to find some appropriate hook of ReduxFramevork, and bind function to it.

    #2509

    Artem Temos
    Keymaster

    Actually, this solution looks pretty good. And we don’t think that using any other hooks will give you better result. So thank you for posting it here, hope it will help somebody with the same question 🙂

    Kind regards

    #6064

    denisyan
    Participant

    Hello! Thanks for solution.
    Can you please describe more where i need to add this to make social share buttons to VK and OK to appear at the Product Page?

    #6071

    Artem Temos
    Keymaster

    Hello,

    You need to override basel_shortcode_social from ‘inc/shortcodes.php’ file in the child theme functions.pho where you will be able to place your additional share buttons.

    Regards

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