Thread Starter
talino
(@talino)
Thanks a lot, now I see that I need a plugin to run PHP from within a post. But still, where do I write my function? Is my theme’s functions.php a good place?
Thanks a lot.
It would depend on what you are adding, but it could be anywhere you want. I run php scripts in my site that are just uploaded into a directory in my wp-content folder.
I would try and place the function you are writing in something that isn’t a core file so that you don’t have to keep updating it as the version changes.
Simple question, what is the function about? Does it involve any other WordPress file or is it standalone?
Trent
talino, your active theme’s functions.php is typically a good place for your own functions, if you’re not up to creating a plugin. But keep in mind functions in that file will not work between themes.
Thread Starter
talino
(@talino)
Not working across themes is indeed a problem, but I don’t see what I can do about it aside from writing a plugin (which I don’t know how to do, I tried reading about it and got totally confused).
The function is a very simple one, a kind of mini gallery. I want to be able to add it between two paragraphs, and it should scan a specified folder and spit out formatted divs & tags based on my folder structure and links. This is so that the mini gallery is automatically updated when I simply upload a new image.
For an example on how this looks: http://www.talino.org/photography/fishermen/
I simply want to write this in a post:
blah blah
<? gallery_here('blah'); ?>
more blah
and have it create this dynamically :
blah blah
<div class="thumbnail"><a href="/images/blah/01.jpg" rel="lightbox[blah]"><img src="/images/blah/thumbs/01.jpg"/></a></div>
<div class="thumbnail"><a href="/images/blah/02.jpg" rel="lightbox[blah]"><img src="/images/blah/thumbs/02.jpg"/></a></div>
more blah
etc, a div for each image in the folder.
I know how to write this function but I simply don’t know where 🙂
Thanks for all your help.