• Skip to primary navigation
  • Skip to main content

RocketGeek

Home of WP-Members, The Original WordPress Membership Plugin

  • WordPress Plugins
    • WP-Members
      • FAQs
      • Quick Start
      • Documentation
      • Extensions
    • Advanced Options
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Download Protect
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Invite Codes
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • MailChimp Integration
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • PayPal Subscriptions
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Salesforce Web-to-Lead
    • Security
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Text Editor
      • Purchase the Plugin
      • Get the Pro Bundle
    • User List
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • User Tracking
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Memberships for WooCommerce
    • WordPass
  • Store
    • Cart
    • Checkout
  • Blog
    • Basics [Free]
    • Tips and Tricks
    • Filters
    • Actions
    • Code Snippets
    • Shortcodes
    • Design
    • Release Announcements
  • Contact
  • Sign In
  • Show Search
Hide Search
Home » Filters » Remove form headings

Remove form headings

Chad Butler · Mar 19, 2014 ·

Depending on how the plugin gets used, sometimes the <legend> tag for the form is not needed. For example, if you have created a login page with the page title “Login”, you do not really need the form to also carry the same text.  Here are some generic utility snippets you can use to remove these various headings.  

This article is only available to WP-Members Support Subscribers. If you have an existing subscription, please login below. If you do not have a current support subscription, you can purchase a support subscription here.

Already a Member? Log In Here
   
Forgot password? Click here to reset

To gain full access to WP-Members premium content, a current support subscription is required. You can purchase an annual support subscription for as little as $59, which provides you with access to priority support, a customer support forum, access to code snippets, and more.

Why wait? Choose your subscription option here.

[
Why join?]

Filters, Tips and Tricks wpmem_inc_changepassword_args, wpmem_inc_login_args, wpmem_inc_resetpassword_args, wpmem_login_form_args, wpmem_register_form_args, wpmem_register_heading, wpmem_user_edit_heading, __return_empty_string

Welcome to RocketGeek Interactive › Forums › Remove form headings

Tagged: wpmem_inc_changepassword_args, wpmem_inc_login_args, wpmem_inc_resetpassword_args, wpmem_login_form_args, wpmem_register_form_args, wpmem_register_heading, wpmem_user_edit_heading, __return_empty_string

  • This topic has 9 replies, 4 voices, and was last updated 2 years, 4 months ago by Chad Butler.
Viewing 5 reply threads
  • Author
    Posts
    • March 19, 2014 at 5:22 pm #4443
      Chad Butler
      Keymaster

      Depending on how the plugin gets used, sometimes the <legend> tag for the form is not needed. For example, if you have created a login page with
      [See the full post at: Remove form headings]

    • September 5, 2014 at 7:24 am #5802
      Fantomas
      Participant

      Hello Chad,

      in which position the snippet had to be placed?

      Greetz Mike

      • September 5, 2014 at 10:14 am #5803
        Chad Butler
        Keymaster

        Hi Mike – these would go into your theme’s functions.php file.

    • November 1, 2016 at 5:12 am #11593
      whitenoise
      Participant

      Excellent!

    • November 22, 2018 at 3:37 pm #16606
      argyrg
      Participant

      Hello…

      Is this still the correct way to remove the legend tags?

      I had success in removing the heading text from my registration form but when I then added

      add_filter( 'wpmem_register_form_args', 'remove_legend_tag' );
      function remove_legend_tag($args){
          return array('heading_before'=>'','heading_after'=>'');
      }

      to the bottom of my functions.php it really screwed up the 2 column layout. It seems like every row is made to be shorter in length than the previous row and the whole 2 columns bit just disappears into a single reducing column…

      When I inspected the code before adding the above snippet I could see the legend tags and the code looks like this

      <fieldset><legend></legend><div class="one-half first"><div class="div_text"><input name="username" type="text" id="username" value="" class="textbox" placeholder="Create a login username*" required=""></div></div><div class="one-half"><div class="div_text"><input name="user_email" placeholder="Email*" type="email" id="user_email" value="" class="textbox" required=""></div></div><div class="one-half first"><div class="div_text"><input name="billing_first_name" placeholder="First name*" type="text" id="billing_first_name" value="" class="textbox" required=""></div></div><div class="one-half"><div class="div_text"><input name="billing_last_name" placeholder="Last name*" type="text" id="billing_last_name" value="" class="textbox" required=""></div></div><div class="one-half first"><div class="div_text"><input name="billing_company" placeholder="Company name*" type="text" id="billing_company" value="" class="textbox" required=""></div></div><div class="one-half"><div class="div_text"><input name="billing_postcode" placeholder="Post code*" type="text" id="billing_postcode" value="" class="textbox" required=""></div></div><div class="one-half first"><div class="div_text"><input name="billing_phone" placeholder="Phone (One we can get you on if there is an issue with your order)*" type="text" id="billing_phone" value="" class="textbox" required=""></div></div><div style="clear:both;"><div class="div_text"><input name="tos" type="checkbox" id="tos" value="agree"><span class="req">*</span> Please indicate that you agree to the <a href="#"> Terms of Service </a> TOS</div></div><div class="one-half"><input name="a" type="hidden" value="register"><input name="wpmem_reg_page" type="hidden" value="https://three.snackserver.uk/register/"><div class="button_div"><input name="submit" type="submit" value="Register" class="buttons"></div><div class="req-text"><span class="req">*</span>Required field</div></div></fieldset>

      After inserting the snippet the code changes to this

      <fieldset><div class="one-half first"><div class="div_text"><input name="username" type="text" id="username" value="" class="textbox" placeholder="Create a login username*" required=""></div><div class="one-half"><div class="div_text"><input name="user_email" placeholder="Email*" type="email" id="user_email" value="" class="textbox" required=""></div><div class="one-half first"><div class="div_text"><input name="billing_first_name" placeholder="First name*" type="text" id="billing_first_name" value="" class="textbox" required=""></div><div class="one-half"><div class="div_text"><input name="billing_last_name" placeholder="Last name*" type="text" id="billing_last_name" value="" class="textbox" required=""></div><div class="one-half first"><div class="div_text"><input name="billing_company" placeholder="Company name*" type="text" id="billing_company" value="" class="textbox" required=""></div><div class="one-half"><div class="div_text"><input name="billing_postcode" placeholder="Post code*" type="text" id="billing_postcode" value="" class="textbox" required=""></div><div class="one-half first"><div class="div_text"><input name="billing_phone" placeholder="Phone (One we can get you on if there is an issue with your order)*" type="text" id="billing_phone" value="" class="textbox" required=""></div><div class="one-half"><input name="a" type="hidden" value="register"><input name="wpmem_reg_page" type="hidden" value="https://three.snackserver.uk/register/"><div class="button_div"><input name="submit" type="submit" value="Register" class="buttons"></div><div class="req-text"><span class="req">*</span>Required field</div><div class="div_text"><input name="tos" type="checkbox" id="tos" value="agree"><span class="req">*</span> Please indicate that you agree to the <a href="#"> Terms of Service </a> TOS</div></div></div></div></div></div></div></div></div></fieldset>

      Clearly the legend tags have gone but so has all of the original formatting.

      Regards
      Russell

      • This reply was modified 2 years, 4 months ago by Chad Butler.
      • This reply was modified 2 years, 4 months ago by Chad Butler.
      • This reply was modified 2 years, 4 months ago by Chad Butler.
      • November 23, 2018 at 6:56 am #16614
        Chad Butler
        Keymaster

        Hi Russell,

        Yes, what you have is correct.

        Are there other filters that you are running with ‘wpmem_register_form_args’? I would suspect that’s the case. If so, you should probably combine everything into one filter because of the way this filter works.

        So we can get a better look at what you’re talking about, set ‘strip_breaks’ to false so you can get the HTML without the line breaks stripped out.

        Once before:

        add_filter( 'wpmem_register_form_args', function() {
        	$args['strip_breaks'] = false;
        	return $args;
        });

        And once after:

        add_filter( 'wpmem_register_form_args', function() {
        	$args['heading_before'] = '';
        	$args['heading_after'] = '';
        	$args['strip_breaks'] = false;
        	return $args;
        });

        That way you can get a better idea of what the HTML is.

    • November 23, 2018 at 7:10 am #16616
      argyrg
      Participant

      Hi Chad,

      Thanks for the prompt response.

      The other relevant code that I have is from the register form (two column version).

      which looks like this

      add_filter( 'wpmem_register_form_args', function() {
          $args['row_before'] = '<div style="clear:both;">';
          $args['row_after'] = '</div>';
          return $args;
      });

      But, I’m not entirely sure where to put this

          function remove_legend_tag($args){
          return array('heading_before'=>'','heading_after'=>'');
      }

      Or if there’s more to it than this? Currently I’ve achieved the desired effect by doing this

      #wpmem_reg legend, #wpmem_login legend {
      font-size: 0px;
      }

      which does the job but is probably not the best way to go about it?

      Russell

      • This reply was modified 2 years, 4 months ago by Chad Butler.
      • This reply was modified 2 years, 4 months ago by Chad Butler.
      • This reply was modified 2 years, 4 months ago by Chad Butler.
      • November 23, 2018 at 8:12 am #16621
        Chad Butler
        Keymaster

        Here’s how you’d do it:

        add_filter( 'wpmem_register_form_args', function() {
        	$args['heading_before'] = '';
        	$args['heading_after'] = '';
            $args['row_before'] = '<div style="clear:both;">';
            $args['row_after'] = '</div>';
            return $args;
        });
    • November 23, 2018 at 12:17 pm #16623
      argyrg
      Participant

      Wonderful,

      That did the trick 🙂

      • November 23, 2018 at 2:20 pm #16624
        Chad Butler
        Keymaster

        Glad to hear that.

  • Author
    Posts
Viewing 5 reply threads
  • You must be logged in to reply to this topic.
Log In

Ready to get started?

Join Today!

© 2021 · butlerblog.com · RocketGeek is built using WordPress, WP-Members, and the Genesis Framework

  • butlerblog.com
  • WP-Members Support Subscription
  • Terms of Service
  • Refund Policy