• Resolved bikeur62

    (@bikeur62)


    Hello,

    I don’t know the PHP language but thanks to the snippets I have added some stuffs. But Since I have added the PHP to add an icon for Apple devices (icon of the app)I have a message error and I cannot go to the /wp-admin anymore ! oO

    The error is

    Warning: Cannot modify header information – headers already sent by (output started at /homepages/18/d516474276/htdocs/wp-content/themes/childstyle/functions.php:130) in /homepages/18/d516474276/htdocs/wp-login.php on line 415

    My php file is:

    <?php
    /*font h2*/
    add_action( 'wp_enqueue_scripts', 'my_google_font' );
    function my_google_font() {
    	wp_enqueue_style( $handle = 'my-google-font', $src = 'https://fonts.googleapis.com/css?family=Knewave', $deps = array(), $ver = null, $media = null );
    }
    /*google analytics*/
    add_action('wp_head','my_analytics',1,20);
    
    function my_analytics() {
        ?>
    
                <script>
      (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
      m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
      })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
    
      ga('create', 'UA-48762025-1', 'beauty-chanel-esthetic.fr');
      ga('send', 'pageview');
    
    </script>
    
        <?php
    }
    
    // NAVBAR WRAPPER //
    add_filter('tc_navbar_display', 'rdc_navbar_display');
    function rdc_navbar_display($output) {
    return preg_replace('|navbar-wrapper clearfix span9|', 'navbar-wrapper clearfix', $output);
    }
    
    // LOGO //
    // center the logo
    add_filter('tc_logo_text_display', 'rdc_custom_center_brand');
    add_filter('tc_logo_img_display', 'rdc_custom_center_brand');
    function rdc_custom_center_brand($output) {
    return preg_replace('|span3|', 'span12', $output);
    }
    
    // TAGLINE //
    // center the Tagline
    add_filter('tc_tagline_display', 'rdc_tagline_display');
    function rdc_tagline_display($output) {
    return preg_replace('|span7|', 'span12', $output);
    }
    
    // SOCIAL ICONS //
    // center the output of tc_social_in_header:
    add_filter('tc_social_in_header', 'rdc_social_in_header');
    function rdc_social_in_header($output) {
    return preg_replace('|span5|', 'span12', $output);
    }
    
    /* Menu: Hover dropdowns + parent links + mobile friendly, voir : https://www.themesandco.com/snippet/menu-hover-dropdowns-parent-links-mobile-friendly/ partie dans CSS aussi*/
    
    add_filter('tc_menu_display', 'acub_menu_display');
    function acub_menu_display($output) {
        echo preg_replace('| class="dropdown-toggle" data-toggle="dropdown" data-target="#"(.+?)<b |', ' class="a-stripped" $1</a><a href="#" class="dropdown-toggle a-caret" data-toggle="dropdown" data-target="#"><b ', $output, -1);
        }
    
    /*secondary menu with css*/
    add_action( 'init', 'register_secondary_menu' );
    function register_secondary_menu() {
        if ( function_exists( 'register_nav_menu' ) ) {
            register_nav_menu( 'secondary-menu', 'Secondary Menu' );
        }
    }
    
    add_filter('__header', 'display_secondary_menu', 1000, 0);
    function display_secondary_menu() {
    	echo ( has_nav_menu( 'secondary-menu' ) ? wp_nav_menu (
            array (
                'theme_location' => 'secondary-menu',
    			'container_id'    => 'secondary-menu',
    			'container_class'    => 'secondary-menu'
            )
        ).'<div class="clearall"></div>' : '' );
    }
    
    /*contact sous slider*/
    add_filter('tc_slider_display', 'content_after_slider');
    function content_after_slider($html) {
    $after_slider = '
    <div class="contact-tel"><a href="tel:0611542970" title="Appeler via Skype">06 11 54 29 70</a></div>
    <div class="contact-mail"><a href="https://beauty-chanel-esthetic.fr/contactez-moi/" title="Envoyer un mail à Chanel">[email protected]</a></div>'; //Put your HTML inside this var
    return $html.$after_slider;
    }
    
    /*Contact B.Lecrinier footer*/
    add_filter('tc_credits_display', 'my_custom_credits');
    function my_custom_credits(){
    $credits = '<a class="siret">Siret 528924350RM059</a>';
    $newline_credits = '<a class="device-computer" title="Disponible sur ordinateur, tablette, mobile" href="https://beauty-chanel-esthetic.fr"></a>
    <br>
    <a class="contact-webmaster" title="Contacter B.Lecrinier" href="https://www.linkedin.com/in/bricelecrinier">Designed by Brice Lecrinier</a>';
    return '
    <div class="span4 credits">
                        <p>&copy; '.esc_attr( date( 'Y' ) ).' <a href="'.esc_url( home_url() ).'" title="'.esc_attr(get_bloginfo()).'" rel="bookmark">'.esc_attr(get_bloginfo()).'</a>'.($credits ? $credits : 'Designed by <a href="https://www.themesandco.com/">Themes & Co</a>').''.($newline_credits ? ''.$newline_credits.'' : '').'</p>        </div>';
    }
    
    /*show meta description*/
    add_filter('tc_show_post_metas' , 'display_metas_on_home');
    function display_metas_on_home( $bool ) {
        return  tc__f('__is_home') ? true : $bool;
    }
    
    /*2nd google+ page (calais) validation*/
    add_action('wp_head','my_googlepluscalais',1,20);
    
    function my_googlepluscalais() {
        ?>
    
                <a href="https://plus.google.com/112083239280005146254" rel="publisher"></a>
    
        <?php
    }
    ?>
    
    <?php
    /*Add Apple icon*/
    add_action('wp_head','Apple_icon',1,20);
    
    function Apple_icon() {
        ?>
    
                <link rel="apple-touch-icon" href="https://beauty-chanel-esthetic.fr/wp-content/uploads/2014/10/apple-touch-icon.jpg"/>
    
        <?php
    }
    ?>
    
    <?php
    // As of 3.1.10, Customizr doesn't output an html5 form.
    add_theme_support( 'html5', array( 'search-form' ) );
    
    add_filter('wp_nav_menu_items', 'add_search_form_to_menu', 10, 2);
    function add_search_form_to_menu($items, $args) {
    
        // If this isn't the main navbar menu, do nothing
        if( !($args->theme_location == 'main') )
            return $items;
    
        // On main menu: put styling around search and append it to the menu items
        return $items . '<li class="my-nav-menu-search">' . get_search_form(false) . '</li>';
    }
    ?>
    <?php
    // Exclude images from search results - WordPress
    add_action( 'init', 'exclude_images_from_search_results' );
    function exclude_images_from_search_results() {
        global $wp_post_types;
    
        $wp_post_types['attachment']->exclude_from_search = true;
    }
    ?>
    <?php
    //LIKE FACEBOOK adds the script in the head of your theme
    add_action ('wp_head' , 'add_fb_button_script');
    
    function add_fb_button_script() {
    ?>
    <div id="fb-root"></div>
    <script>(function(d, s, id) {
      var js, fjs = d.getElementsByTagName(s)[0];
      if (d.getElementById(id)) return;
      js = d.createElement(s); js.id = id;
      js.src = "//connect.facebook.net/fr_FR/sdk.js#xfbml=1&appId=444497645668109&version=v2.0";
      fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));</script>
    <?php
    }

    Thanks for you help

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Modify header information ERROR’ is closed to new replies.