• I’m using a code to make a ratings plugin appear in my custom taxonomy.

    if ( $terms ) {
    			foreach ( $terms as $term ) {
    
    				if ( in_array( $term->name, array( 'Services', 'Book Designing', 'Coaching and Consulting',
    						'Copywriting', 'Critiquing', 'Editing', 'Freelance Writing', 'Literary Agent',
    						'Marketing and Promoting', 'Proofreading', 'Publishing' ) ) ) {
    					$found = true;
    					break;
    				}

    It should appear in all the categories listed here, but I noticed that instead of “Literary Agents,” the plugin developer wrote “Literary Agent,” and so the ratings don’t show in that category. I simply added an “s” to the end, and I get this error on the front end:

    Warning: Cannot modify header information – headers already sent by (output started at /home/curveson/public_html/wp-content/themes/template_New_Child_Theme_1/functions.php:1) in /home/curveson/public_html/wp-content/themes/BT/framework/class/class_layout.php on line 152

    It doesn’t matter what I do in this file. The smallest of changes creates an error. Can someone help me with this? I have no idea how to change Agent to Agents without an error. I’d really appreciate some help. Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • In your functions.php, the opening PHP tag (<?php) must be the very first thing in the file, with no spaces, tabs, line breaks, etc. before it. Can you check to make sure you didn’t accidentally add a space or anything else before the opening tag?

    Thread Starter dee_c

    (@dee_c)

    Thanks for responding so quickly!

    There are no spaces before the opening tag. In fact, everything was working fine before I added the ‘s’.

    At first the developer told me what custom code to use in my functions.php. Every time I added the code, I got that error. I used Filezilla, which is usually perfect for me. The developer then added the code for me with no problems.
    Now I want to add a single ‘s’ and I get an error. I’m baffled.

    what method are you using to edit that file?

    https://codex.www.ads-software.com/Editing_Files

    Thread Starter dee_c

    (@dee_c)

    I use an FTP Client which opens up Notepad. I’ve never had a problem with this before.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Copy all of the code from your functions.php file and paste it into PasteBin: https://pastebin.com

    Then link us that

    Thread Starter dee_c

    (@dee_c)

    Thanks! Here’s the link:

    https://pastebin.com/7fyTmrjR

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Slightest change to function.php causes error’ is closed to new replies.