PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Set post CSS style from Post Submission form

  1. hopborns

    I have created a GravityForm that lets users submit posts from the front end and defines the category that will be assigned to the post. I am trying to have the form set the final post's custom CSS style by using a Custom Field, but it's not working.

    The post submission form is at Once you submit a post, it will appear in the sidebar of the parent page for the category ( If you click on the post title in the sidebar, you'll go to the full post page (, followed by whatever you entered as the Title on the Gravity Form). For this category, the background should be a brick-red pattern (the same background that appears on Instead it is displaying the teal background that is the site default.

    This section of the site (everything that has "womencare" in the URL) is not live, so you can try submitting a post for testing purposes. The form will be password protected once it goes live.

    Posted 10 years ago on Thursday December 6, 2012 | Permalink
  2. How does the site know to use the color from the custom field as the post custom CSS? Can you show us how you are doing that?

    Also, is the correct information being stored in the custom field?

    I could not submit as the page is password protected now, indicating it's live, I think.

    You could you use a custom body class for the post category, but that would be completely unrelated to Gravity Forms. That would just add a body class for your post type, and then that body class would have category-specific styling.

    Posted 10 years ago on Monday December 10, 2012 | Permalink
  3. hopborns

    Each post category has a custom body class which uses category-specific styling to set the background color, etc.. Our Gravity Form uses a custom field to set the category. The custom field on DOES set the post to the correct category and correctly displays the post only on the sidebar assigned to that category. It does NOT carry on to set the custom body class.

    FYI, the site is built on Thesis, if that matters to choosing the correct custom field.

    I have temporarily removed the password so that you can experiment. I will have to put the password back by the end of the week.

    Posted 10 years ago on Monday December 10, 2012 | Permalink
  4. Is there are reason for this: "It does NOT carry on to set the custom body class." It looks to me like "womencare" is being added to the body class:

    <body class="custom womencare womencare">

    Additionally, I created a test post, here:

    And I see the red brick background. Screenshot:

    Maybe there is a cache issue which is preventing you from seeing the same thing?

    Posted 10 years ago on Tuesday December 11, 2012 | Permalink