newbie question: best way to integrate new function
-
hi all
i’ve written a small custom function which allows me to easily create an image gallery based on the content of a specified folder. it’s based on a tip i saw somewhere, which allows lightbox js to create a slideshow after clicking on a single thumbnail, by hiding all the images except the first one with css.
since i’ve never done this before, i’m not sure how the code is supposed to integrate wordpress. for now, it’s inside a custom page template (the function as well as the call to it), but this doesn’t seem right. it makes the template become the actual content, and i would like to be able to call the function from within a post (actually, from within a “page”).
i’d like know if the function code is supposed to go into the functions.php file of my theme, or as a plugin, or somewhere else. and how can i call it from within the post, like other custom functions do (with code such as [gallery]). will i be able to pass parameters to it?
i’ve posted the code at https://www.talino.org/gallery_code.txt (it is inside the page template, right before the loop). it simply takes a folder, a title and the css selector which is set to hide, scans a folder and spits out the correct html. it works fine for me, it just seems in the wrong place.
thanks for any help
- The topic ‘newbie question: best way to integrate new function’ is closed to new replies.