Support

Account

Forum Replies Created

  • Hi Elliot,

    I did some digging around to try and find where I had read that and came up with these 2

    http://hardcorewp.com/2013/always-omit-closing-php-tags-in-wordpress-plugins/
    http://wordpress.org/support/topic/functionsphp-in-a-child-theme

    I think in my case having read the WP.org one and the error saying it was on line 35 when my functions.php only went to line 33 this probably surmises by problem:

    The Codex isn’t wrong. There should be closing PHP tag at the end of the file. Furthermore, that closing tag has to be the very last line of the file. If you have any blank lines after the closing tag, that can break things, too.

    There isn’t any visible text after the closing tag but it appears it might not have been the last line…

    Will check that tonight and try putting the closing tag back in.

    Thanks

    Andrew

  • Just checked the code and if I have

    <?php
    
    function my_toolbars( $toolbars )
    {
    	// return $toolbars - IMPORTANT!
    	return $toolbars;
    }
    
    ?>

    I get the same error messages, however,

    <?php
    
    function my_toolbars( $toolbars )
    {
    	// return $toolbars - IMPORTANT!
    	return $toolbars;
    }

    Then it works fine as does the original paste from the explanation page… so that seems to have sorted it…?

  • Hi Elliot,

    I’ve just been experimenting with the code and if I remove the closing ?> on the final line it all seems to work fine.

    I can check the above if you want – I presume I would wrap that in <?php … ?> though?

    Thanks

    Andrew

  • Hi Elliot,

    Thanks for the advise, I thought it was probably a more robust solution to use but just wanted to confirm I was on the right track.

    I will brush on my PHP and re-read the documentation on the image field to implement.

    On the repeater field I’ll definately make a purchase on that soon, I was just wanting to get to grips with a slightly simpler (if more repetitive) version dealing with one field at a time as a starting point.

    Out of interest is there a donate option somewhere as I didn’t notice an obvious one. I’ll be buying the repeater add-on and possibly the gallery one but a general donation option might also be good for such a great and useful plugin coupled with great support! 🙂

    Kind Regards

    Andrew

  • Hi Elliot,

    I’ve just copied the code from you example as below – but the strange thing is that there isn’t any code on line 35 – the file ends on line 33 … I created the functions.php file just for this so it’s the only thing in it?

    Is it because I’ve closed the php tag at the end – I’m sure I read somewhere it can cause problems?

    Entire code of functions.php

    <?php
     
    add_filter( 'acf/fields/wysiwyg/toolbars' , 'my_toolbars'  );
    function my_toolbars( $toolbars )
    {
    	// Uncomment to view format of $toolbars
    	/*
    	echo '< pre >';
    		print_r($toolbars);
    	echo '< /pre >';
    	die;
    	*/
     
    	// Add a new toolbar called "Very Simple"
    	// - this toolbar has only 1 row of buttons
    	$toolbars['Very Simple' ] = array();
    	$toolbars['Very Simple' ][1] = array('bold' , 'italic' , 'underline' );
     
    	// Edit the "Full" toolbar and remove 'code'
    	// - delet from array code from http://stackoverflow.com/questions/7225070/php-array-delete-by-value-not-key
    	if( ($key = array_search('code' , $toolbars['Full' ][2])) !== false )
    	{
    	    unset( $toolbars['Full' ][2][$key] );
    	}
     
    	// remove the 'Basic' toolbar completely
    	//unset( $toolbars['Basic' ] );
     
    	// return $toolbars - IMPORTANT!
    	return $toolbars;
    }
     
    ?>
  • Try again with screenshot

  • Hi Elliot,

    Sorry for being a total newbie here but I made a straight copy of the code from the link in your reply and pasted it into functions.php in my child theme. The code did as the comments said but I can’t update any posts etc now and am getting errors when I try to update the ACF group or save any post.

    Screenshot of error below:

    Error screenshot

    Thanks

    Andrew

  • Thanks Elliot that’s great, I’ll have a play around with that and have a look at using the PHP function in the link to recheck the output.

    Andrew

  • Firstly sorry for the rather unclear title – not sure I have the option to edit it?

    I found this with some more searching – http://us3.php.net/strip_tags – which might be an option but I’m kinda hoping there’s a simpler solution around ACF?

    Thanks

    Andrew

Viewing 9 posts - 1 through 9 (of 9 total)