Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1181080
    freshhope
    Participant

    Hi there support team!

    I have tried adding some actions to my header for favicon and Moment.js, however I am getting this error or the normal enqueue of the parent stylesheet:

    Fatal error: Call to undefined function add_filter() in /home/content/19/10640719/html/schoolhousecafe/wp-content/themes/x-child/functions.php on line 19

    Here’s the code I’m trying to get working:

    add_action( 'wp_head', 'x_custom_head_js' );
    function x_custom_head_js(){
    
    	?>
    <script language="javascript" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.0/moment.min.js"></script>
    	<?php
    }
    
    add_action('wp_head','favicon_bits');
    function favicon_bits() {
     echo '<link rel="apple-touch-icon" sizes="57x57" href="/apple-icon-57x57.png"/>';
     echo '<link rel="apple-touch-icon" sizes="60x60" href="/apple-icon-60x60.png"/>';
     echo '<link rel="apple-touch-icon" sizes="72x72" href="/apple-icon-72x72.png"/>';
     echo '<link rel="apple-touch-icon" sizes="76x76" href="/apple-icon-76x76.png"/>';
     echo '<link rel="apple-touch-icon" sizes="114x114" href="/apple-icon-114x114.png"/>';
     echo '<link rel="apple-touch-icon" sizes="120x120" href="/apple-icon-120x120.png"/>';
     echo '<link rel="apple-touch-icon" sizes="144x144" href="/apple-icon-144x144.png"/>';
     echo '<link rel="apple-touch-icon" sizes="152x152" href="/apple-icon-152x152.png"/>';
     echo '<link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-180x180.png"/>';
     echo '<link rel="icon" type="image/png" sizes="192x192"  href="/android-icon-192x192.png"/>';
     echo '<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"/>';
     echo '<link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png"/>';
     echo '<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"/>';
     echo '<link rel="manifest" href="/manifest.json"/>';
     echo '<meta name="msapplication-TileColor" content="#ffffff"/>';
     echo '<meta name="msapplication-TileImage" content="/ms-icon-144x144.png"/>';
     echo '<meta name="theme-color" content="#ffffff"/>';
    }

    Thanks!

    #1181105
    Paul R
    Moderator

    Hi,

    Can you share to us the entire code in your functions.php file.

    Thanks

    #1181122
    freshhope
    Participant

    Of course Paul, thank you.

    <?php
    
    // =============================================================================
    // FUNCTIONS.PHP
    // -----------------------------------------------------------------------------
    // Overwrite or add your own custom functions to X in this file.
    // =============================================================================
    
    // =============================================================================
    // TABLE OF CONTENTS
    // -----------------------------------------------------------------------------
    //   01. Enqueue Parent Stylesheet
    //   02. Additional Functions
    // =============================================================================
    
    // Enqueue Parent Stylesheet
    // =============================================================================
    
    add_filter( 'x_enqueue_parent_stylesheet', '__return_true' );
    
    // Additional Functions
    // =============================================================================
    
    add_action( 'wp_head', 'x_custom_head_js' );
    function x_custom_head_js(){
    
    	?>
    <script language="javascript" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.0/moment.min.js"></script>
    	<?php
    }
    
    add_action('wp_head','favicon_bits');
    function favicon_bits() {
     echo '<link rel="apple-touch-icon" sizes="57x57" href="/apple-icon-57x57.png"/>';
     echo '<link rel="apple-touch-icon" sizes="60x60" href="/apple-icon-60x60.png"/>';
     echo '<link rel="apple-touch-icon" sizes="72x72" href="/apple-icon-72x72.png"/>';
     echo '<link rel="apple-touch-icon" sizes="76x76" href="/apple-icon-76x76.png"/>';
     echo '<link rel="apple-touch-icon" sizes="114x114" href="/apple-icon-114x114.png"/>';
     echo '<link rel="apple-touch-icon" sizes="120x120" href="/apple-icon-120x120.png"/>';
     echo '<link rel="apple-touch-icon" sizes="144x144" href="/apple-icon-144x144.png"/>';
     echo '<link rel="apple-touch-icon" sizes="152x152" href="/apple-icon-152x152.png"/>';
     echo '<link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-180x180.png"/>';
     echo '<link rel="icon" type="image/png" sizes="192x192"  href="/android-icon-192x192.png"/>';
     echo '<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"/>';
     echo '<link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png"/>';
     echo '<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"/>';
     echo '<link rel="manifest" href="/manifest.json"/>';
     echo '<meta name="msapplication-TileColor" content="#ffffff"/>';
     echo '<meta name="msapplication-TileImage" content="/ms-icon-144x144.png"/>';
     echo '<meta name="theme-color" content="#ffffff"/>';
    }
    
    #1181164
    Thai
    Moderator

    Hi There,

    Your entire code is working fine on my end.

    In this case, would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:

    – Link login to your site
    – WordPress Admin username / Password
    – FTP Account

    Don’t forget to select Set as a private reply. This ensures your information is only visible to our staff.

    Thanks.

    #1181194
    freshhope
    Participant
    This reply has been marked as private.
    #1181255
    Paul R
    Moderator

    Hi,

    I tried activating your child theme and didn’t get a fatal error.

    Kindly check again in your end.

    Thanks

    #1181424
    freshhope
    Participant

    Hi,

    It appears that my server is down. I will check when it’s back up again.

    Ollie

    #1181550
    Rupok
    Member

    Hey Ollie,

    Thanks for updating and it’s still seems down and getting WordPress error. Let us know when you are ready.

    Cheers!

  • <script> jQuery(function($){ $("#no-reply-1181080 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>