• I’m very new working with WordPress self hosted. So I’m not sure if this is the correct forum so…. here goes.

    I have written a server based application that periodically captures images over an extended period of times. And then, php scripts which allow the user to select with family of images and time interval they wish to “play” and loads them and plays them a part of the content in a HTML page.

    Now I would like to add this functionality into my WordPress site either in pages or posts.

    Two starting questions:

    1. Is this a Plugin function or an [insert_php][/insert_php]. I have been experimenting with the later. Why one or the other??

    2. Where do I locate the php and javascript files, which plays the images in the page and extracts the images from the captured images, and a symbolic link to the directory structure for the captured images so http “src=” tags can load the infomation

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator bcworkz

    (@bcworkz)

    I’d advise against using the [insert_php] shortcode. It’s not part of the core WP distribution and is intended for simpler PHP scripts than you are envisioning. The extra processing as a shortcode adds unnecessary overhead.

    Since you are organizing content, this is really theme territory more than plugin territory. You don’t have to write a theme though. You create a child of your normal theme. Your PHP code would go on a custom page template. Add a new page based on this template so you have a permalink with which to request your content.

    Load any javascript with wp_enqueue_script() called from code placed in your child theme’s functions.php. If you must use a plugin instead of a child theme, this is possible, but adding custom page templates from a plugin is rather convoluted.

    Instead of adding a bunch of links to all the things I’ve mentioned, I’m going to let you search for them. The Google search from this site’s header works fine. Any links in the search results that go to the Codex or developer resources will be what you want. Ignore links to forums or plugins. If you have trouble finding something specific, let me know, I probably can find it. For the most part though, I figure you can search as well as I can 🙂

    Thread Starter bmrzmr2

    (@bmrzmr2)

    Thanks for the feedback. I will investigate your suggestion.
    Roy

    Thread Starter bmrzmr2

    (@bmrzmr2)

    Thanks bcworkz (@bcworkz) for your feedback.

    I’m not clear on how my “page contents” is a child Theme. I envision adding the “image viewer” as one of the elements within a Page or Post. I will continue to see if I can find something similar.

    Another question, I would like to add either AJAX calls or regular <input….. submit> calls to allow the viewer to modify what is displayed. In my initial search all I find is in AJAX or <input> interaction with wp-admin.

    There is nothing saved. The user is adjusting what is displayed.

    Moderator bcworkz

    (@bcworkz)

    Right, that’s my point actually. Your page content and associated code is not part of a child theme, but it should be. By creating a child theme, any custom work you do is safe from theme updates. Adding custom work to distributed themes is dangerous, it can all be lost in an update.

    If you’re willing to use AJAX to generate all of your content, you may not need a custom page template. You still need a way to initiate an AJAX request. You could have the user add a shortcode to page content, or automatically create such a page on plugin or theme activation.

    While it’s true AJAX requests need to go through /wp-admin/admin-ajax.php, the request can come from anywhere and thus the response is sent back to your script on that anywhere page. Your script can then add the returned data to a DOM element. WP doesn’t know if this script is on an admin page or not, and doesn’t care. The AJAX handler doesn’t need to save anything, but it does need to process the request and return an appropriate response.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘A Plugin or “insert php” function and directory/file location in WordPress’ is closed to new replies.