Skip to content
Advertisement

How can we add wpform to custom theme

I create custom theme and I am trying to create a contact form using wpform but for some reasons the form doesn’t show on my page

here is a code from the custom theme

<?php 
    /* Template Name: CallUS*/
    get_header();?>

<section>
      <div class="u-clearfix u-sheet u-valign-middle-xs u-sheet-1">
        <h1>
          call us
        </h1>
        <img
          class="u-image u-image-default u-image-1 u-hidden-xs"
          src="<?php bloginfo('template_directory');?>/images/---1113.png"
          alt=""
          data-image-width="800"
          data-image-height="972"
        />
      </div>
</section>
<?php get_footer();?>

and this picture from the form that I have created using wpform

Advertisement

Answer

Way 01: You must have the_content() function in order to show page contents. I’ve edited your code so you can see how to do it:

<?php 
    /* Template Name: CallUS*/
    get_header();?>

<section>
      <div class="u-clearfix u-sheet u-valign-middle-xs u-sheet-1">
        <h1>
          call us
        </h1>
        <img
          class="u-image u-image-default u-image-1 u-hidden-xs"
          src="<?php bloginfo('template_directory');?>/images/---1113.png"
          alt=""
          data-image-width="800"
          data-image-height="972"
        />
       <?php
        while ( have_posts() ) :
            the_post();

            the_content();

        endwhile; // End of the loop.
        ?>
      </div>
</section>
<?php get_footer();?>

Then you’ve to select CallUS Page Template from below page: enter image description here

Way 02: If you go to the WPForms from the menu then you can see the shortcode column on each row. it will be like [wpforms id="123"]

WP form shortcode

Copy your design shortcode from there and use that directly into your file like below:

<?php 
    /* Template Name: CallUS*/
    get_header();?>

<section>
      <div class="u-clearfix u-sheet u-valign-middle-xs u-sheet-1">
        <h1>
          call us
        </h1>
        <img
          class="u-image u-image-default u-image-1 u-hidden-xs"
          src="<?php bloginfo('template_directory');?>/images/---1113.png"
          alt=""
          data-image-width="800"
          data-image-height="972"
        />
        <?php echo do_shortcode('[wpforms id="3306"]');?>
      </div>
</section>
<?php get_footer();?>
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement