Jump to content

westside

New Members
  • Posts

    4
  • Joined

  • Last visited

westside's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks a bunch for the help!
  2. Well, I just had a typo it seems, the above code I just posted seems to work. I had the semi-colon outside of the closing curly brace, I just moved it inside of it, uploaded the php file to the dev server and it appears to work fine.... whadya know If there is a more preferred way to doing what I want, I'd like to know though.. Thanks!
  3. Here is the full code block and that may be why what I've tried isn't working. I added curly braces to the if statement and added the else part and closed it with curly braces <?php if ( $registration_enabled ) : ?> <fieldset> <label><?php _e( 'Your email address', 'wp-jm' ); ?> <?php if ( ! $account_required ) { echo '<small>' . __( '(optional)', 'wp-jm' ) . '</small>'; } else { echo '(required)';} ?></label> <div class="field"> <input type="email" class="input-text" name="create_account_email" id="account_email" required placeholder="<?php esc_attr_e( '[email protected]', 'wp-jm' ); ?>" value="<?php if ( ! empty( $_POST['create_account_email'] ) ) echo sanitize_text_field( stripslashes( $_POST['create_account_email'] ) ); ?>" /> </div> </fieldset> <?php endif; ?>
  4. Hi, I'm very new to PHP, 2 days in fact, but I've done some programming in other languages. I'm trying to do something pretty basic here. I've inherited a site built on WordPress and I'm trying to override one of the php files contained in a wordpress plugin to do what I want. I have this line: <label> <?php if ( ! $account_required ) echo '<small>' . __( '(optional)', 'wp-jm' ) . '</small>'; ?> </label> I understand what the code is doing, if condition is false, then output the HTML <small> tag, I want to add and else condition to the above, that outputs the word "required" in place of where the word optional is. So if $account_required = false then shows the optional in parenthesis as it does now, otherwise I want to show the word "required" in the parenthesis. Super simple, but just can't get the syntax quite right. Also, can someone explain the double underscore part, specifically this: __( '(optional)', 'wp-jm' ) I understand in PHP periods are used to concatenate, but what is the leading double underscore right before the word "optional" in parenthesis? it's as if there is some function being called or referenced. The end result when the HTML is rendered is "(optional)", but what's up with the leading underscore and the reference to "wp-jm" I assume that there is some plugin or something... Any help appreciated. Thanks....
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.