Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1075468

    Hi everyone,

    this is a question for the Enfold Community as a whole and not a support question.

    I’m wondering what your go-to functions, hooks, filters and snippets of code are and what you have in your default child theme and functions.php that you use when you provision a site?

    For example, my child theme looks like this:

    /child-theme-name
    /shortcodes
    – functions.php
    – login-logo.png (login logo to replace WordPress)
    – screenshot.png (880×660 pixel image for the themes page)
    – style.css

    And my default functions.php is:

    <?php
    
    //Enable Custom class for all elements
    add_theme_support('avia_template_builder_custom_css');
    
    /* 
    //Enable support for shortcodes
    add_filter('avia_load_shortcodes', 'avia_include_shortcode_template', 15, 1);
    function avia_include_shortcode_template($paths)
    {
    	$template_url = get_stylesheet_directory();
      array_unshift($paths, $template_url.'/shortcodes/');
    	return $paths;
    }
    */
    
    /*
    //Add Widget area to header
    add_action( 'ava_main_header', 'enfold_customization_header_widget_area' );
    function enfold_customization_header_widget_area() {
    dynamic_sidebar( 'header' );
    }
    */
    
    /*
    //set builder mode to debug
    add_action('avia_builder_mode', "builder_set_debug");
    function builder_set_debug()
    {
      return "debug";
    }
    */
    
    //Add dynamic year in Socket Copyright
    // Add [year] to Socket
    function year_shortcode() {
    	$year = date('Y');
    	return $year;
    }
    add_shortcode('year', 'year_shortcode');
    
    // Change login Logo URL
    function my_login_logo_url() {
        return home_url();
    }
    add_filter( 'login_headerurl', 'my_login_logo_url' );
    
    // Change Login Logo Text
    function my_login_logo_url_title() {
        return 'Digital Essence';
    }
    add_filter( 'login_headertitle', 'my_login_logo_url_title' );
    
    //Add Company Logo to login page
    function my_login_logo() { ?>
        <style type="text/css">
    	.login {background: #3A3A3A!important;}
    	#loginform {background: #3A3A3A!important; box-shadow:none!important; color: #fff!important;}
    	#loginform label {font-size: 1.2em; color: #fff;}
    	#nav a, #backtoblog a {color: #fff!important; font-size:1.2em;}
            #login h1 a, .login h1 a {
                background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/login-logo.png);
    		width:150px;
    		height:150px;
    		background-size: 150px 150px;
    		background-repeat: no-repeat;
            	padding-bottom: 0px;
            }
        </style>
        <?php }
    	add_action( 'login_enqueue_scripts', 'my_login_logo' );

    I use others regularly but these are in my default functions file which I use to kick each project off. Pretty sure I need to add more but you know what it’s like, list of things to do is always long.

    So, what do you have in your child theme when you provision a site?

    #1076845

    Hey DigitalEssence,

    I think this is best as a question for our Facebook Group :)

    Best regards,
    Basilis

    #1077021

    Hi @basilis,

    do you have a link for the group? There are a few.

    #1077109

    Hi,
    Thanks for sharing, I look forward to seeing more replies. I believe the group Basilis is talking about is here
    Another function many people use often is the moral box (lightbox popup),

    function popup_inline() { ?>
    <script type="text/javascript">
    jQuery(window).load(function(){
      jQuery('.open-popup-link').magnificPopup({
        type:'inline',
        midClick: true
      });
    });
    </script>
    <?php }
    
    add_action('wp_head', 'popup_inline');

    Best regards,
    Mike

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.