• On the first day of a new job as a web designer, having barely worked with wordpress before, I was asked to write a form inside of a wordpress page (rather then post).

    I’ve already found/installed a plugin that’ll let me create the form, the only issue is that my boss wants me to figure out a way to put it on the page so that the client we’re making it for doesn’t accidentally delete the code that’s showing the form (or disrupt its positioning).

    We need to allow the client to update a list of classes along the left, and have the form available on the right for users to fill out.

    Can anyone provide me with some advice on how to hardcode or tamperproof the form and its location to avoid the client calling us back in a rage? If it helps, the form plugin I’m using is Fast Secure Contact Form.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    You’re in luck. Per the FAQ for the WordPress plugin, you can embed the contact form within a page template.

    It won’t be quite tamper proof, but will prevent them from casually deleting the short code in the page editor.

    http://codex.wordpress.org/Templates

    http://www.fastsecurecontactform.com/faq-wordpress-version

    Personally when possible I prefer the do_shortcode myself.

    <php? echo do_shortcode('[si-contact-form form="1"]'); ?>

    From that FAQ this ought to work too.

    <?php
    if ( isset( $si_contact_form ) )  {
       echo $si_contact_form->si_contact_form_short_code( array( 'form' => '1' ) );
    }
    ?>

    Good luck.

    Thread Starter rhovisions

    (@rhovisions)

    Ah, very cool, thanks! I feel like I should have been able to figure it out, but new job, don’t wanna spend too long on the project and get the new boss upset :-/

    A bit of css to position the form, and I should be good!

    Thread Starter rhovisions

    (@rhovisions)

    Actually a follow up…

    My boss says I should be able to use custom tags to add the calendars straight into the page. Is there a way to add code into the custom tags section? I guess I’m not quite sure if I’m being misdirected or just missing something.

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    You may want to peruse the source code of some themes, just to familiarize your self with the template tags. There’s a ton of good built in ones.

    http://codex.wordpress.org/Template_Tags

    Just as you could with the contact form, that new page template can use hard coded template tags to display what you like.

    http://codex.wordpress.org/Function_Reference/get_calendar

    In this case it’s probably want

    <?php get_calendar(); ?>

    Wrap that in a <div class="some-css"> and you’ll be able to style it as you see fit.

    Thread Starter rhovisions

    (@rhovisions)

    Sorry, I misspoke and was a bit unclear.

    Looking on the page editor, there is a section for custom fields. Apparently I’m supposed to be able to code the stuff into a custom field/include the info from another file using the custom fields?

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    Ah, got it. It’s similar, with different template tags.

    http://codex.wordpress.org/Custom_Fields

    Give the portion for displaying custom fields a look.

    I’m supposed to be able to code the stuff into a custom field/include the info from another file using the custom fields?

    Sorta. The custom fields are another piece of data, so you can put in conditionals in your PHP and perform different tasks based on that data.

    http://codex.wordpress.org/Custom_Fields#Advanced_Techniques_for_Custom_Fields

    I’ve not tried it myself but searching for “using custom fields in WordPress” brought up some interesting examples.

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

The topic ‘Adding custom code/php to a WP install’ is closed to new replies.