Forums

[resolved] function.php errors !!! (4 posts)

  1. omidgs
    Member
    Posted 1 year ago #

    Hello

    I created a theme , when i am logining im admin page this error dispaled
    Warning: Cannot modify header information - headers already sent by (output started at /home/celatini/public_html/wp-content/themes/New Folder (2)/functions.php:1) in /home/celatini/public_html/wp-includes/pluggable.php on line 897

    and more similar errors

    i only use this codes in function.php

    <?php add_theme_support('post-thumbnails'); ?>
    <?php
    function new_excerpt_length($length) {
    return 55;
    }
    add_filter('excerpt_length', 'new_excerpt_length');
    ?>

    <?php function new_excerpt_more($more) {
    global $post;
    return 'ID) . '">[ادامه]';
    }
    add_filter('excerpt_more', 'new_excerpt_more');

    ?>

    plaese help me to solve problem

  2. omidgs
    Member
    Posted 1 year ago #

    Hey guys what i should do?

  3. hameedullah
    Member
    Posted 1 year ago #

    You need to remove the space between PHP tags. The best thing is to not close the php tags at all.

    Below is how your functions.php should look like:

    <?php
    // php tag start here and it does not close
    
    add_theme_support('post-thumbnails');
    
    function new_excerpt_length($length) {
    return 55;
    }
    add_filter('excerpt_length', 'new_excerpt_length');
    
    function new_excerpt_more($more) {
    global $post;
    return 'ID) . '">[ادامه]';
    }
    add_filter('excerpt_more', 'new_excerpt_more');
    // no closing php tag
  4. omidgs
    Member
    Posted 1 year ago #

    very nice thanks

Topic Closed

This topic has been closed to new replies.

About this Topic