Link to home
Start Free TrialLog in
Avatar of dcallas
dcallas

asked on

WordPress Page with Embedded Gravity Form

My company has a WordPress site that was developed by a third-party firm who is now out of business.  They built a great site for us, complete with a custom theme and some great functionality, but they're no longer available to make some changes that we need.  We can handle simple content changes via the WordPress CMS, and we have a highly capable development team who maintains our internal application, but we don't have anybody on staff who knows WordPress/PHP well enough to make more complicated changes (like modifying the theme/template pages).

At the moment, our immediate issue is that we need to replicate a specific page that has an embedded form (built with Gravity Forms).  For most of our pages, it's relatively easy to see the content blocks in the CMS -- but for this page, there are no content blocks:

User generated image
When the page is loaded, our standard header and footer appear correctly and the main/content section is populated with our Gravity Form (the one with ID=2 from the list below):

User generated image
Now we need to make a slightly different version of this page and this form.  When I duplicate the page and change nothing, the same form appears.  This suggests to me that code in the TEMPLATE is triggering the form to appear (when I change the template on the duplicated page, the form no longer appears).  

So my question is: how/where do I look in my WordPress files to find code linking that template with that form?  I have access to all the source files and I have a strong background in HTML, JavaScript, VBA, PL/SQL, CSS and a few others (in other words, I'm comfortable with web development and diving into the code, I just don't know WordPress and/or PHP... but I think I have the vocabulary and understanding to make the necessary change if somebody points me in the right direction).  I think I need to either create a new template that points to the new form (and change my duplicated page to that new template in the CMS), or I need to modify the existing template so it displays one form or the other depending on .... the URL I guess?    

Can anybody point me in the right direction or help me get started?  In your replies, please assume that I have above-average coding skills for a non-coder, but also assume that I know very little about WordPress and PHP.
ASKER CERTIFIED SOLUTION
Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Place the template code here.
Avatar of dcallas
dcallas

ASKER

So what I would do is go to the backend and then go to Appearance | Editor and look at the list of files on the right until you find the right one.  Opening that file should tell you how to proceed - either copying the template to a new one or doing a deeper dive via get_template_part().

Place the template code here.

Here's the code from the file I located per your instructions above:

<?php
/*
Template Name: New Judge Profile
*/
?>

<div class="contact-section-wrapper">
	<?php gravity_form( 2, false, false, false, '', false ); ?>
</div>

<?php // while (have_posts()) : the_post(); ?>
  <?php get_template_part('templates/content', 'page'); ?>
<?php // endwhile; ?>

Open in new window


What does that tell you about how I should to proceed?

Thank you both for your prompt responses.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dcallas

ASKER

Do the following:

1) Copy that file
...
3) Save template, have a beer.

That is more or less what I surmised, however I can't locate that file.  It is called 'page-new-judge.php' but I don't see it anywhere in our theme directory:

User generated image
Where else should I look and/or can I duplicate it from within the CMS?
Where did you obtain the code in your first response?
Possibly look in the wp-content directory.
Avatar of dcallas

ASKER

FYI - here are the templates available to me in the CMS when editing a page.  Currently, the form page I'm trying to duplicate uses the one labeled "New Judge Profile".  

When I review the list of files in Appearance|Editor, there are MANY more files than this listed... so I assume I'm trying to replicate the template file in a manner that will insert another <option> in this <select>:

User generated image
From which file did you obtain the code in your first response.
Avatar of dcallas

ASKER

Where did you obtain the code in your first response?

From Appearance|Editor ... I located the file on the right, like you instructed, and saw the code when I clicked on it.  I did not see an option to duplicate the file, so I assumed I'd have to do that directly in the file directory (i.e., duplicate/modify a local copy of the file and then upload).  But I don't see the file anywhere.

Possibly look in the wp-content directory.

I did a keyword search for the filename in the domain-level directory, so I don't think there's a file with that specific name.  Though I will look manually/more thoroughly in the numerous subfolders in case there is an indexing issue with my search.
Avatar of dcallas

ASKER

From which file did you obtain the code in your first response.

User generated image
Okay, so somewhere on your system is a file called page-new-judge.php

That's the file that needs to be duplicated, renamed, and edited.  As to where it would be, your prior devs made this a bit difficult and you will have to look through the folders to find it.  If you can locate the basic page.php template, I'm pretty sure it will contain references to other folders via get_template_part() and conditional statements.
Make sure you have downloaded all of the files on your system.
Avatar of dcallas

ASKER

I ran a VBA script in Excel to list every file name in our domain-level directory and all subdirectories (over 7,000 total files) and none have that specific name.  The page.php file in wp-content\themes\OurThemeName just has the following:

<?php while (have_posts()) : the_post(); ?>
  <?php get_template_part('templates/page', 'header'); ?>
  <?php get_template_part('templates/content', 'page'); ?>
<?php endwhile; ?>

Open in new window


Here is the code from templates/page-header.php:
<!-- <div class="page-header">
  <h1>
    <?php echo roots_title(); ?>
  </h1>
</div>
 -->

 

Open in new window


And here is the code from templates/content-page.php:
<?php the_content(); ?>
<?php wp_link_pages(array('before' => '<nav class="pagination">', 'after' => '</nav>')); ?>

Open in new window


I should also note that in wp-content/themes, there are 7 theme folders in addition to our company-named theme.  Is it possible/likely/certain that I should be searching those theme folders too?  Doesn't explain why the file name wouldn't be listed in my VBA-generated list, but I thought I'd mention it.

@rgranlund: I synced all files this morning, and just confirmed that nothing in the live directory differs from my local directory (unless there a bunch of hidden files that I can't see?).
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dcallas

ASKER

First, thank you for your back-and-forth on this... I know it's difficult to troubleshoot something when you can't dive into the files/code yourself, so I appreciate your patience and assistance.

Yes.  It is possible your previous developers created your current theme as a child theme of one of the other ones present.  Check your current theme's style.css file to be sure:

I'll look into that... but it doesn't change the fact that a search of the ENTIRE domain-level directory returned no files with that name... is that stumping you as much as it is stumping me?  Or is there a logical explanation for this?
is that stumping you as much as it is stumping me?  Or is there a logical explanation for this?

It's a little perplexing, but there's always an explanation in the end.
If you have not found it yet, possibly do a site wide search for "New Judge Profile". Those words will be commented out at the top of the template.