• Resolved vtinath

    (@vtinath)


    Hi,
    I’ve been trying to get wordpress to offer me the option between “standard” and “link” posts.

    I’m using my own custom theme, not based on any default one.

    I managed to get it working in my category template using advice from this thread. Yay.

    But, in order to be able to select a post format in the admin panel, as I understand, I also need to add

    <?php add_theme_support( 'post-formats', array( 'standard', 'link' ) ); ?>

    to functions.php.

    This works, BUT, with errors. It shows me the option to select between “link” and “standard” formats, but when I save the post, I get this error:

    Warning: Cannot modify header information – headers already sent by (output started at /home/public_html/wp-content/themes/2015/functions.php:3) in /home/public_html/wp-admin/post.php on line 237

    Warning: Cannot modify header information – headers already sent by (output started at /home/public_html/wp-content/themes/2015/functions.php:3) in /home/public_html/wp-includes/pluggable.php on line 1196

    The post gets saved correctly in spite of the error, but it is annoying to keep getting it on every content update.

    Is there something else I need to do to get this working right?
    I have read about post formats and adding theme support in the codex but I’m none the wiser.

    Here’s my functions.php:
    http://pastebin.com/yrXZUqKD

    Any help appreciated!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The problem is all of the opening and closing PHP tags that you have. That’s causing the functions.php file to output blank new-lines before anything is supposed to be output.

    You only want to have one opening <?php tag, and no closing tag in the file. As a (very) truncated example…

    <?php
        add_theme_support( 'post-formats', array( 'standard', 'link' ) ); ?>
        remove_filter( 'the_content', 'wpautop' );
        remove_filter( 'the_excerpt', 'wpautop' );
    
        // Add the rest of the PHP lines here - WITHOUT any tags.
    Thread Starter vtinath

    (@vtinath)

    That seems to have worked! Thank you SO much!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Adding theme support for post formats – I get some errors’ is closed to new replies.