• Resolved Robin W

    (@robin-w)


    Very strange behaviour which I hope you can help with

    When using a shortcode I have written, a saving a page errors with

    Warning: Cannot modify header information – headers already sent by (output started at /www2/a36/dev.mysite.com/web/wp-content/themes/italybiketours/shortcodes-tiles.php:26) in /www2/a36/dev.italybiketours.co.uk/web/wp-admin/post.php on line 197

    Warning: Cannot modify header information – headers already sent by (output started at /www2/a36/dev.mysite.com/web/wp-content/themes/italybiketours/shortcodes-tiles.php:26) in /www2/a36/dev.italybiketours.co.uk/web/wp-includes/pluggable.php on line 1210

    I’ve tested with minimum – child of twenty seventeen theme and shortcode only function, only plugin yoast seo.

    Doesn’t error with yoast deactivated

    Sole page content

    [itb-tile page = ‘/gran-fondo-packages/’ pic=’/wp-content/uploads/2016/08/granfondotour3-560×460.jpg’ title=’Gran Fondo Packages’]
    [itb-tile page = ‘/gran-fondo-packages/’ pic=’/wp-content/uploads/2016/08/granfondotour3-560×460.jpg’ title=’Gran Fondo Packages’]
    [itb-tile page = ‘/gran-fondo-packages/’ pic=’/wp-content/uploads/2016/08/granfondotour3-560×460.jpg’ title=’Gran Fondo Packages’]

    shortcode set up in function file

    add_shortcode('itb-tile', 'itb_tile');  
    function itb_tile ($attr) {
    	if (!empty( $attr['pic'])) $pic_url=$attr['pic']	;
    	if (!empty( $attr['page'])) $page=$attr['page']	;
    	if (!empty( $attr['title'])) $title=$attr['title']	;
    	?>
    	
    	<div class="element portfolio3filter_wrapper">
    		<div class="one_third gallery3 filterable gallery_type animated1">
    			<a href=" <?php echo $page ?> ">
    				<img src=" <?php echo $pic_url ?> " alt=" <?php echo $title ?> " /></a>
    					
    					
    					
    					<div class="thumb_content fullwidth">
    						<div class="thumb_title">
    					
    					
    					
    						<a href=" <?php echo $page ?> "><h3><?php echo $title ?></h3></a>
    						</div>
    						<div class="thumb_meta">
    						</div>
    				</div>
    			</div>
    	</div>
    	
    <?php
    }

    The error doesn’t happen if yoast is deactivated, and the page saves correctly whether yoast is activated or not.

    • This topic was modified 7 years, 4 months ago by Robin W.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi Robin,

    That sounds like a conflict of some kind. We need some more information.

    • Is the shortcode code you have written or does it come from a theme or plugin?
    • Can you confirm the issue happens when Yoast is the only plugin active and your theme is on 2017?

    Let us know.

    Thread Starter Robin W

    (@robin-w)

    yes I’ve written it

    yes it happens on twentyseventeen and with just yoast.

    you can add the function and set up the codes in a page – they go nowhere but that doesn’t matter.

    UPDATE : if you only have one

    [itb-tile page = ‘/gran-fondo-packages/’ pic=’/wp-content/uploads/2016/08/granfondotour3-560×460.jpg’ title=’Gran Fondo Packages’]

    but any multiple fails

    it works – no idea why

    Hi,

    Thanks for the fast response! We understand you may need help with the code that was written. We are not familiar with the code or how it is expected to work with the Yoast SEO plugin. Please know that we can’t offer support on custom code (needed to change (core) features of our plugin or elsewhere). Since we don’t want to take the risk that we break your website by suggesting incorrect or incomplete code, we cannot advise you on how to make such changes.

    Maybe someone watching these forums can assist you further, but if your topic is inactive for 2 weeks, we’ll mark it as resolved to keep the overview.

    Thread Starter Robin W

    (@robin-w)

    I don’t need help with the code written – the code written works perfectly well.

    I only have an error when yoast is active.

    but appreciate that you can’t look in detail into every issue.

    Thanks for your initial response.

    • This reply was modified 7 years, 4 months ago by Robin W.

    Hi Robin,

    We are not sure why the issue happens with your code. We suggest creating an issue on our GitHub repository here for our developers. You may need an account in order to post.

    Thread Starter Robin W

    (@robin-w)

    thanks – I’ll do that

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Headers already sent error’ is closed to new replies.