Search
Code Directory
 ASP
 ASP.NET
 C/C++
 CFML
 CGI/PERL
 Delphi
 Development
 Flash
 HTML
 Java
 JavaScript
 Pascal
 PHP
 Python
 SQL
 Tools
 Visual Basic & VB.NET
 XML
New Code
Rapid PHP 2018 15.5
IBDAC 6.4
Online Course Booking Script 1.3.3
Database Workbench Pro 5.6.4
Job Portal Script 1.3.2
The C# PDF Library 5.2
PostgreSQL Data Access Components 6.0
Virtual Data Access Components 11.0
HTMLPad 2018 15.5
WeBuilder 2018 15.5
SentiMask SDK Trial 2.0.0
Track Order For Magento 2 1.0.0
Calendar 365 For Dynamics CRM 4.0
Scimbo 1.2
Odoo Furnito Theme 1.0
Top Code
Azizi search engine script PHP 4.1.10
Killer Guestbook Script 1.1
RLS Algorithm Demo 1.0
The Spherical K-means algorithm 1.0
Hotel Management System Restaurant Version 5.25
AJ Matrix v2.6
Linear Mixed Integer Program Solver 1.0
Billing System 1.0.1
Personal Web Portal 5.0
Radius Authentication Plugin 0.8
IDAutomation MICR E13B Font Advantage 11.1
Chessgra 1.1
ASP.NET Authentication
Keno Game 1.I
VChess 6.x-1.x-dev
Top Rated
VisualNEO Web 2018.12.15
Azizi search engine script PHP 4.1.10
Paste phpSoftPro 1.4.1
Extreme Injector 3.7
Deals and Discounts Website Script 1.0.2
ADO.NET Provider for ExactTarget 1.0
Solid File System OS edition 5.1
Classified Ad Lister 1.0
Aglowsoft SQL Query Tools 8.2
Invoice Manager by PHPJabbers 3.0
ICPennyBid Penny Auction Script 4.0
PHP Review Script 1.0
ATN Resume Finder 2.0
ATN Site Builder 3.0
Availability Booking Calendar PHP 1.0
PHP Shortcode 1.3
File ID: 93915






PHP Shortcode 1.3
Download PHP Shortcode 1.3http://wordpress.orgReport Error Link
License: Freeware
File Size: 10.0 KB
Downloads: 21
User Rating:1 Stars  (1 rating)
Submit Rating:
PHP Shortcode 1.3 Description
Description: Based on kukukuan's Inline PHP, this plugin allows you to embed and run PHP code in posts, pages or widgets* with a WordPress shortcode.

(* Requires a shortcode enabled widget plugin, such as Section Widget.)
Usage

The plugin provides two pairs of shortcodes - [php]code[/php] and [echo]code[/echo]. these two pairs of shortcodes resembles the functionality of the <?php code ?> and <?= code ?> tags in a normal PHP script, respectively.

For example:

The answer to the <em>ultimate</em> math challenge, <strong>1+2</strong>, is...
[php]
$a = 1;
$b = 2;

echo $a + $b;
[/php]

Will become:

The answer to the <em>ultimate</em> math challenge, <strong>1+2</strong>, is...
3

The [echo] tag will automatically print the returned value of the first expression. Therefore, [echo]some_function()[/echo] is essentially equivalent to [php]echo some_function()[/php].
Some Important Notes

** This plugin will change the priority of the do_shortcode filter. If you are experiencing any conflict with other shortcode plugins, please disable the plugin and report the problem in the forums. **

Although I said the shortcode pairs resembles a <?php code ?> tag pair, there is an important difference. The PHP code in the shortcodes are executed in a "throw-away" local namespace, instead of the global one. All variables defined in a [php] code [/php] block cannot be accessed outside the block. Therefore, this will not work:

[php]
$a = 1;
$b = 2;
[/php]

The answer to the <em>ultimate</em> math challenge, <strong>1+2</strong>, is... [echo]$a+$b[/echo]

And neither would this:

[php]
$my_array = array('apple','orange');

foreach($my_array as $fruit):
[/php]

I like [echo]$fruit[/echo]

[php]endforeach;[/php]

To work around the first problem, you may use the global keyword:

[php]
global $a, $b;
$a = 1;
$b = 2;
[/php]

The answer to the <em>ultimate</em> math challenge, <strong>1+2</strong>, is... [php]global $a, $b; echo $a+$b[/php]

And to work around the second problem, you may use "real" PHP closing tags within your [php] code [/php] block to switch between PHP and HTML mode:

[php]
$my_array = array('apple','orange');

foreach($my_array as $fruit):
?>

I like <?php echo $fruit; ?>

<?php
endforeach;
[/php]

(Yes, it is a bit weird... you'd probably want to avoid doing that if possible.)

Installation:

1. Extract the zip file and drop the contents in the wp-content/plugins/ directory of your WordPress installation
2. Activate the Plugin from Plugins page

License: Freeware

Related: Plugin, Answer, ltemgtultimateltemgt, challenge, shortcode, Problem, Block, Global, fphp, shortcodes, pairs, phpthe, foreachmy array, Array, resembles, Scripts, Php, shortcode scripts, php shortcode, php shortcode scripts

O/S:BSD, Linux, Solaris, Mac OS X

File Size: 10.0 KB

Downloads: 21



More Similar Code

Allow PHP in posts and pages adds the functionality to include PHP in wordpress posts and pages by adding a simple shortcode [php].code.[/php]

This plugin strips away the automatically generated wordpress <p /> and tags but still allows the addition of your own <p /> and tags

Please update immeadiatly if using version 1.2.2

Install :

1. Extract the zip file and drop the contents in the...



Based on Luke Howell's quote rotator plugin, the flexi quote rotator plugin allows you to add the quotations to your site using a shortcode or php snippet in template instead of only as a widget. Also adds a settings panel to the admin and...



Kazoo Templated Content allows you to use inline templates to program against the WordPress API anywhere you can use a shortcode without PHP.

* Include a custom templated posts loop anywhere.
* Include a custom templated pages...



The Display Posts Shortcode was written to allow users to easily display listings of posts without knowing PHP or editing template files.

Add the shortcode in a post or page, and use the arguments to query based on tag, category, post...



Features at a glance:

* Shortcode for embedding into posts/pages
* PHP function for templating/theming
* Does albums, galleries, or latest pictures
* Supports Nextgen Gallery media-rss.php and its options
*...



The d-deDUMeta Functions Shortcoded-deDt Plugin installs the Shortcode d-de?metad-deOao. With it you can access the custom fields of your articles by a simple shortcode.

Shortcode Syntax: [meta func="" name=""...



Quickly add tables to any post or page using simple shortcode commands.

Installation :

1. Upload quicktables.php to the /wp-content/plugins/ directory
2. Activate the plugin through the 'Plugins' menu in WordPress



Using this plugin you can execute arbitrary PHP code using shortcodes in your posts, pages, comments, widgets and RSS feeds, just like manually defined shortcodes. The shortcodes and associated PHP code are defined using the settings of this...



Creates a shortcode or PHP snippet for inserting dynamic, highly customizable lists of posts or pages into your post content or theme.

Plugin by Kalin Ringkvist at http://kalinbooks.com/

Plugin URL:...



A flexible shortcode and lookup tool for creating internal links in post/page content (or anywhere shortcodes are parsed). A lookup tool is added to the sidebar of the post edit screen for locating shortcodes for internal posts.

A...

User Review for PHP Shortcode
- required fields
     

Please enter text on the image