ThemeForest

PHP Snippets in Wordpress

4265 posts
  • Has been a member for 3-4 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Contributed a Tutorial to a Tuts+ Site
  • Contributed a Blog Post
  • Interviewed on the Envato Notes blog
  • Grew a moustache for the Envato Movember competition
  • Community Moderator
  • Exclusive Author
  • Beta Tester
  • Sold between 1 000 and 5 000 dollars
  • Bought between 10 and 49 items
  • United Kingdom
  • Referred between 1 and 9 users
Reaper-Media says

Ok guys, here’s my situation; I am developing a php application, and I need users to be able to include php snippets which display dynamic content generated by the application.

The normal use of the application on a generic php page would be as follows:

<?php include("folder/location_of_app/a_file.php");
activateAppFunction(parameters);
?>

So, is it easy to do the same thing within a wordpress website in the area you would like the content to be displayed? Any info is helpful.

Thanks guys :)

Posted 2 years ago VIA ActiveDen | Permalink
Reaper-Media is an Envato staff member
419 posts
  • Has been a member for 3-4 years
  • Exclusive Author
  • Beta Tester
  • Sold between 1 000 and 5 000 dollars
  • Bought between 10 and 49 items
  • United States
  • Referred between 10 and 49 users
vasilios says

Sorry but I don’t get what you’re trying to accomplish. It probably makes sense (and is doable) but I just can’t wrap my head around what you’re describing.

Posted 2 years ago VIA CodeCanyon | Permalink
2201 posts
  • Has been a member for 3-4 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Contributed a Tutorial to a Tuts+ Site
  • Author had a File in an Envato Bundle
  • Exclusive Author
  • Sold between 1 000 and 5 000 dollars
  • Bought between 1 and 9 items
  • Netherlands
ArikB says

You want to know if you can execute a script from within the content panel in wp?

Posted 2 years ago VIA GraphicRiver | Permalink
1116 posts
  • Has been a member for 2-3 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Exclusive Author
  • Beta Tester
  • Sold between 1 000 and 5 000 dollars
  • Bought between 50 and 99 items
  • Canada
mafloral says

Here is a great site you might find what you are trying to do:

http://www.sysdeco.no/doc/LangRef/default.htm?turl=activateapp.htm

Posted 2 years ago VIA ActiveDen | Permalink
4265 posts
  • Has been a member for 3-4 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Contributed a Tutorial to a Tuts+ Site
  • Contributed a Blog Post
  • Interviewed on the Envato Notes blog
  • Grew a moustache for the Envato Movember competition
  • Community Moderator
  • Exclusive Author
  • Beta Tester
  • Sold between 1 000 and 5 000 dollars
  • Bought between 10 and 49 items
  • United Kingdom
  • Referred between 1 and 9 users
Reaper-Media says

Okay, here is an example: there is a PHP file which someone buys off CodeCanyon, it is an image gallery, but it is a very complex image gallery with many features. All of it’s files are stored in it’s own directory called ”/image_gallery/”. It has it’s own admin panel and everything which is accessed completely seperately from the main wordpress site by going to the address http://site.com/image_gallery/admin/

If someone wants to display the image gallery on a PHP page, they would add the php code:

&lt;?php include("/image_gallery/php/display.php");
showGallery("animals");
?&gt;

...so a full page might look like this:

<html>
<head>
<title>Image Gallery - Animals</title>
</head>

<body>
<?php include("/image_gallery/php/display.php");
showGallery("animals");
?>
</body>
</html>

So that’s how someone would incorporate the file in a basic php page.

NOTE : my file is not an image gallery, I’m using an image gallery as an example, but it does use this method to be incorporated in a page.

So, what I’m saying is, if I had a wordpress site, and I had a page where I would like to display the gallery, and I had to include a seperate php file and initiate a function, and wanted it to be in the main area of the page… Is it possible, and is it easy for any buyer to do it if they wanted to use this image gallery in their wordpress website.

Posted 2 years ago VIA ActiveDen | Permalink
Reaper-Media is an Envato staff member
47 posts
  • Has been a member for 3-4 years
  • Exclusive Author
  • Sold between 100 and 1 000 dollars
  • Bought between 100 and 499 items
  • Germany
Kai-ser says

i think yes. I’ve bought the Simple Newsletter System and managed to include it in my custom sidebar just by include(‘newsletter.php’).

Posted 2 years ago VIA AudioJungle | Permalink
4265 posts
  • Has been a member for 3-4 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Contributed a Tutorial to a Tuts+ Site
  • Contributed a Blog Post
  • Interviewed on the Envato Notes blog
  • Grew a moustache for the Envato Movember competition
  • Community Moderator
  • Exclusive Author
  • Beta Tester
  • Sold between 1 000 and 5 000 dollars
  • Bought between 10 and 49 items
  • United Kingdom
  • Referred between 1 and 9 users
Reaper-Media says
i think yes. I’ve bought the Simple Newsletter System and managed to include it in my custom sidebar just by include(‘newsletter.php’).

Good thanks! :)

Posted 2 years ago VIA ActiveDen | Permalink
Reaper-Media is an Envato staff member
10 posts
  • Has been a member for 3-4 years
  • Exclusive Author
  • Sold between 100 and 1 000 dollars
  • Bought between 1 and 9 items
  • Referred between 1 and 9 users
dreampopclub says

I don’t think Wordpress will allow you to execute any php that is not hard coded into the template files without first installing a plugin like Exec-php

Posted 2 years ago VIA GraphicRiver | Permalink
659 posts
  • Has been a member for 3-4 years
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Bought between 10 and 49 items
  • United States
  • Referred between 10 and 49 users
luckykind says
I don’t think Wordpress will allow you to execute any php that is not hard coded into the template files without first installing a plugin like Exec-php

Yeah… that’s been my experience too… the user would need to use the plugin…

However, asking users to add php ( especially those who don’t understand php ) might be a bad idea, as it can easily be screwed up… I’d look into finding away around that… maybe using Custom Fields or something, not sure as it’s hard to tell how exactly your UI flow works…

Posted 2 years ago VIA ThemeForest | Permalink
419 posts
  • Has been a member for 3-4 years
  • Exclusive Author
  • Beta Tester
  • Sold between 1 000 and 5 000 dollars
  • Bought between 10 and 49 items
  • United States
  • Referred between 10 and 49 users
vasilios says

I would be careful of Exec-php because there could be some nasty security issues with that. Your best bet would be to use shortcodes. I haven’t played around with them, but they seem really easy to use (if you know adequate PHP ). :)

Posted 2 years ago VIA CodeCanyon | Permalink
by
by
by
by
by