Forums

Contact Form In Sidebar (3 posts)

  1. slamdunksy21
    Member
    Posted 1 year ago #

    On one of my sites, I'd like to have a different contact form in the sidebar depending on the page. For example, have a contact form in the sidebar that goes to the windows guy on the windows page, the doors guy on the doors page, etc.

    I have no problem creating a different sidebar depending on the page, but the problem I'm running into is the contact form. I can't A.) Figure out how to make this work with widgets OR B)Find a contact form that works outside of posts/page.

    I would probably prefer option B as its a little bit easier for me to control/code. Basically, I just need a contact form plugin that works outside of a post/page? Any suggestions?

  2. Jake Gevorgian
    Member
    Posted 1 year ago #

    Hi, actually I found your comment while searching for a solution for a problem that was very similar to yours and I found that:

    You can achieve a [contact form] output in any location of the page -- be it a sidebar, header, footer and so forth -- by doing the following (in my case this I did:)

    1. Write a Page and name it 'contact' and insert the [contact form] data and publish.

    2. Open the file where you like to show the [contact form] -- which in our case is Sidebar file -- and insert the following code:

    <?php
    query_posts('pagename=contact');
    if (have_posts()) : while (have_posts()) : the_post();
    the_content();
    endwhile; endif;
    ?>

    3. Save the file and look for mail :)

    Best,
    Jake

  3. slamdunksy21
    Member
    Posted 1 year ago #

    I'll give that a shot. It sounds like it would work, although it is a little more complicated then I'd like. I've used photo gallery plugins, etc. when you can simply add a few extra lines of code to make it work outside of a blog/post but this doesn't seem to be the case with contact forms.

Topic Closed

This topic has been closed to new replies.

About this Topic