-2
function custom_content_filter_the_content( $content ) {

$colorsList = array(
    'Baby Blue' => "66CCFF",
    'Beige' => "CC9966",
    'Black' => "000000",
    'Blue' => "0000CC",
    'Blush' => "FF9999",
    'Brown' => "663300",
    'Burgundy' => "660000",
    'Champagne' => "FFFFCC",
    'Coral' => "FF6666",
    'Cream' => "FEE5A4",
    'Dust Blue' => "6699CC",
    'Emerald' => "006600",
    'Fuchsia' => "FF00CC",
    'Gold' => "CFB53B",
    'Gray' => "999999",
    'Green' => "339900",
    'Lavender' => "EAD3FF",
    'Lime' => "00FF33",
    'Maroon' => "800000",
    'Mint' => "80FEA5",
    'Navy' => "000066",
    'Orange' => "FF3300",
    'Peach' => "F4A17D",
    'Pink' => "F96EAE",
    'Purple' => "990099",
    'Red' => "FF0000",
    'Seafoam' => "66CC99",
    'Silver' => "CCCCCC",
    'Teal' => "008080",
    'Turquoise' => "34DDDD",
    'Violet' => "330099",
    'White' =>  "FFFFFF",
    'Yellow' => "FFFF00"
);
$styles = get_the_term_list( $post->ID, 'styles', '<li>', '</li><li>', '</li>' );
$venues = get_the_term_list( $post->ID, 'venues', '<li>', '</li><li>', '</li>' );
$colors = get_the_terms(   $post->ID, 'colors' );

if (!empty($styles) || !empty($venues) || !empty($colors)):
$content .=
    '<div class="style-guide clearfix" data-equalizer>
       <h3 class="the_look">The Look</h3>

    <div class="guide" data-equalizer-watch>
      <h4>Styles</h4>
        <ul class="styles">
          '.$styles.'
      </ul>
    </div>

    <div class="guide" data-equalizer-watch>
      <h4>Venues</h4>
        <ul class="venues">
        '.$venues.'
        </ul>
    </div>

    <div class="guide color-list" data-equalizer-watch>
      <h4>Colors</h4>';
        if(!empty($colors)):
        $content .= '<ul class="colors">';
        foreach($colors as $color)
        {
            $link = get_term_link( $color );
            foreach($colorsList as $key => $list)
            {
                if(strtolower($key) == strtolower($color->name))
                {
                    $content .= '<li class="color"><a href="'.$link.'"><span class="circle" style="background-color: #'.$list.'">&nbsp;</span></a></li>';
                }
            }
        }
        $content .= '</ul>';
        endif;
        $content .= '</div></div>';
        endif;
        return $content; }
add_filter( 'the_content', 'custom_content_filter_the_content' );

closed as off-topic by Pieter Goosen, TheDeadMedic, Howdy_McGee, Sisir, Mark Kaplun Aug 25 '15 at 5:37

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions that are too localized (such as syntax errors, code with restricted access, hacked sites, hosting or support issues) are not in scope. See how do I ask a good question?" – Pieter Goosen, TheDeadMedic, Mark Kaplun
If this question can be reworded to fit the rules in the help center, please edit the question.

0

You are getting that because the $post variable isn't set. You'll need to call global $post at the beginning of your function.

function custom_content_filter_the_content( $content ) {
    global $post;
    ...

Not the answer you're looking for? Browse other questions tagged or ask your own question.