이 플러그인은 최근 3개의 주요 워드프레스 출시와 시험 되지 않았습니다. 워드프레스의 좀 더 최근 버전으로 이용할 때 더 이상 관리되지 않고 지원되지 않고 호환성 문제가 있을 수 있습니다.

PHP Code Widget

설명

The normal Text widget allows you to insert arbitrary Text and/or HTML code. This allows that too, but also parses any PHP code in the text widget and executes it.

This can make it easier to migrate to a widget-based theme. However, this plugin should not be used long term, as anybody with access to edit the widgets on your site will be able to execute arbitrary PHP code.

All PHP code must be enclosed in the standard php opening and closing tags ( <?php and ?> ) for it to be recognized and executed.

Only users with the unfiltered_html role will be allowed to insert unfiltered HTML. This includes PHP code, so users without admin or editor permissions will not be able to use this to execute code, even if they have widget editing permissions.

스크린샷

  • The widgets screen showing a PHP code widget in use.
  • The output of the widget on the site.

FAQ

There’s some kind of error on line 27!

That error means that your PHP code is incorrect or otherwise broken.

But my code is fine!

No, it’s not. Really.

This widget has no real errors in it, it’s about the simplest widget one can possibly make. Any errors coming out of the “execphp.php” file are errors in code you put into one of the widgets. The reason that it shows the error being in the execphp.php file is because that is where your widget’s code is actually being run.

So, if it says that you have an error on line 27, I assure you, the problem is yours. Please don’t email me about that error.

I have code that works normally in a template but doesn’t work when in the widget?

Code in a template runs in the global context. Code in the widget will run in a function context. Make sure that you declare any global variables as global before attempting to use them.

후기

2020년 August 13일
create_function() is deprecated. //add_action('widgets_init', create_function('', 'return register_widget("PHP_Code_Widget");')); /* new code */ function PHP_Code_Widget_register(){ register_widget( 'PHP_Code_Widget' ); } add_action('widgets_init', 'PHP_Code_Widget_register');
2020년 June 6일
No highlighting for snippets.Support also doesn't exists. You can find much better plugins to insert php code snippets
2020년 February 3일
A very useful widget. Especially in emergency situations when there is no time to write your own solution for your task.
2019년 September 20일
I was trying to find the updated plugin for PHP and at last I found this, because they update there plugin regularly. So I must say to enjoy this plugin.
모든 65 평가 읽기

기여자 & 개발자

“PHP Code Widget”(은)는 오픈 소스 소프트웨어입니다. 다음의 사람들이 이 플러그인에 기여하였습니다.

기여자

“PHP Code Widget”(이)가 18(으)로 번역되었습니다. 기여해 주셔서 번역자님께 감사드립니다.

자국어로 “PHP Code Widget”(을)를 번역하십시오.

개발에 관심이 있으십니까?

코드 탐색하기는, SVN 저장소를 확인하시거나, 개발 기록RSS로 구독하십시오.

변경이력

2.3

  • Changed the call to WP_Widget to use the PHP 5 __construct() method. Ref: https://make.wordpress.org/core/2015/07/02/deprecating-php4-style-constructors-in-wordpress-4-3/

2.2

  • Translation fixes for WP 3.7
  • Remove donation link

2.1

  • Fixed broken wpautop filter. Checkbox on widget works now.

2.0

  • Changed widget to use new Class methods for creating widget. This simplifies the widget and should eliminate any problems with it losing code or disappearing from sidebars and so forth.