• Hi, I need to hack a template and force the php code in the sidebar.php file.

    The research I did so far tells me to use the following code but it does not work:

    <?php
    if ( isset($si_contact_form) ) echo
    $si_contact_form->si_contact_form_short_code( array( ‘form’ => ‘1’ ) );
    ?>

    I’m using wordpress 3.4.2 and Plugin version 4.0.16.

    Can someone please help me out?

    Thanks a bunch!

    http://wordpress.org/plugins/si-contact-form/

Viewing 5 replies - 1 through 5 (of 5 total)
  • You are missing the curly brackets.

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

    Be sure to set the correct form number for example, for form 2 you have to set: ‘form’ =>’2′

    This may work also:
    <php? echo do_shortcode('[si-contact-form form="1"]'); ?>

    Thread Starter article89

    (@article89)

    Mike, thank you so much for responding quickly. I tried both options and it just doesn’t work, the form does not show on the sidebar. This php code is surrounded by other php and html code so I decided to paste the entire content of the file for you to see if there’s anything around it that might be breaking it. Thanks a lot once again.

    [please mark any posted code, or better use the pastebin – http://codex.wordpress.org/Forum_Welcome#Posting_Code – some of the code below might be broken]

    <?php
    /**
     * The Sidebar containing the main widget area.
     *
     * @package WordPress
     * @subpackage Cyon Theme
     */
    
    ?>
    			<?php if(is_front_page()){ ?>
    				<?php if(of_get_option('homepage_layout')!='general-1column'){ ?>
    					<!-- Sidebars -->
    					<div id="secondary" class="widget-area" role="complementary">
    		<?php cyon_sidebar_before(); ?>
    						<?php if(of_get_option('homepage_layout')=='general-2right'){ ?>
    							<?php dynamic_sidebar( 'right-sidebar' ); ?>
    						<?php }elseif(of_get_option('homepage_layout')=='general-2left'){ ?>
    							<?php dynamic_sidebar( 'left-sidebar' ); ?>
    						<?php } ?>
    						<?php cyon_sidebar_after(); ?>
    					</div>
    				<?php } ?>
    			<?php }elseif( get_post_meta($post->ID,'cyon_layout',true)=='default' || !get_post_meta($post->ID,'cyon_layout',true) ){ ?>
    				<!-- Sidebars -->
    				<div id="secondary" class="widget-area" role="complementary">
    
    <div class="sidebar-community-button">
    <a href="http://www.sunnyside.cc/our-communities/sunnyside-harrisonburg/"><img src="http://www.sunnyside.cc/wp-content/uploads/2013/11/sunnyside-sidebar-sunnyside-communities.png"/></a>
    </div>
    <!--END .sidebar-community-button-->
    
    <div class="sidebar-community-button">
    <a href="http://www.sunnyside.cc/our-communities/kings-grant-martinsville/"><img src="http://www.sunnyside.cc/wp-content/uploads/2013/11/kings-grant-sunnyside-communities.png"/></a>
    </div>
    <!--END .sidebar-community-button-->
    
    <div class="sidebar-community-button">
    <a href="http://www.sunnyside.cc/our-communities/summit-square-waynesboro/"><img src="http://www.sunnyside.cc/wp-content/uploads/2013/11/summit-square-sunnyside-communities.png"/></a>
    </div>
    <!--END .sidebar-community-button-->
    
    <div class="schedule-visit-wrapper">
    <a href="http://www.sunnyside.cc/plan-a-visit/">
    <img src="http://www.sunnyside.cc/wp-content/uploads/2013/11/schedule-an-appointment-sidebar-sunnyside-communities.png"/></a>
    </div>
    <!--END .schedule-visit-wrapper-->
    
    <div class="sidebar-form-wrapper" style="background-color:#73A86F; width:170px; padding: 0 15px;">
    <a href="http://www.sunnyside.cc/contact-us/">
    <h1 style="font-size:19px; text-align:center; padding-top:6px; color:#fff;">Got a</h1>
    <h1 style="font-size:19px; text-align:center; padding:5px 0; color:#fff;">Question?</h1>
    </a>
    
    <php? echo do_shortcode('[si-contact-form form='1']'); ?>
    
    </div>
    <!--END .sidebar-form-wrapper-->
    
    <div class="contact-info-wrapper">
    <img src="http://www.sunnyside.cc/wp-content/uploads/2013/11/contact-us-sidebar-sunnyside-communities.png"/><div style="border:4px solid #73A86F; text-align:center; color:#473E3E; font-size:18px; background-color:#ffffff;">
    
    <div style="margin-bottom:14px !important; line-height:110%; margin-top:10px;">Sunnyside:
    <a href="1-800-237-2257">1-800-237-2257</a></div>
    
    <div style="margin-bottom:14px !important; line-height:110%;"><b>King’s Grant</b>:
    <a href="1-800-462-4649">1-800-462-4649</a></div>
    
    <div style="margin-bottom:14px !important; line-height:110%;"><b>Summit Square</b>:
    <a href="1-800-586-5499">1-800-586-5499</div>
    </div>
    
    </div>
    <!--END .contact-info-wrapper-->
    
    <div class="social-sidebar-wrapper">
    
    <div class="social-button social-gap">
    </a><a href="#"><img src="http://www.sunnyside.cc/wp-content/uploads/2013/11/youtube-sidebar-sunnyside-communities.png"/></a>
    </div>
    <!--END .social-button-->
    
    <div class="social-button">
    <a href="https://www.facebook.com/pages/Sunnyside-Communities/172745656094558"><img src="http://www.sunnyside.cc/wp-content/uploads/2013/11/facebook-blue-sidebar-sunnyside-communities.png"/></a>
    </div>
    <!--END .social-button-->
    
    </div>
    <!--END .social-sidebar-wrapper-->
    
    <div class="myclear"></div>
    
    				</div>
    			<?php }else{ ?>
    
    				<!-- Sidebars -->
    				<div id="secondary" class="widget-area" role="complementary">
    					<?php cyon_sidebar_before(); ?>
    					<?php if(get_post_meta($post->ID,'cyon_layout',true)=='general-2right'){ ?>
    						<?php dynamic_sidebar( 'right-sidebar' ); ?>
    					<?php }elseif(get_post_meta($post->ID,'cyon_layout',true)=='general-2left'){ ?>
    						<?php dynamic_sidebar( 'left-sidebar' ); ?>
    					<?php } ?>
    					<?php cyon_sidebar_after(); ?>
    				</div>
    			<?php } ?>

    Why not try adding shortcode into a new text widget in the WP admin screen?
    http://www.fastsecurecontactform.com/sidebar-widget
    See if that works

    Thread Starter article89

    (@article89)

    I had to hack all this code into the sidebar.php because the widgets were not being displayed properly in all pages with sidebars. Now, the sidebar shows great in all the pages but the the form still doesn’t. So to answer your question, I can’t do that. What else can I try?

    I do not have support for theme templates, you could try the theme support. sorry. The code I gave you is correct.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to insert form code manually without using shortcode’ is closed to new replies.