Support » Plugins » Adding a link to Password Protection Text in the post-template.php

  • Thomasjohnwallin

    (@thomasjohnwallin)


    I want to add a link to the text that gets displayed over password protected posts.
    Whenever I try to just simply add the html code in the php file where I have the text, I get a T string error.
    I know there is something wrong with the code I’m adding to the post-template.php.

    I want to know how to fix this.

    For example, I want the words “Subscribe” and “vicepresident@williamsburgrowing.org” to contain links.
    See here:
    http://williamsburgrowing.org/2013-colonial-erg-sprints-coachs-summary/

    Here is the code:

    function get_the_password_form() {
    	$post = get_post();
    	$label = 'pwbox-' . ( empty($post->ID) ? rand() : $post->ID );
    	$output = '<form action="' . esc_url( site_url( 'wp-login.php?action=postpass', 'login_post' ) ) . '" method="post">
    	<p>' . __("This post is for members only. To gain access, please subscribe.  Members enter your password below:") . '</p>
    	<p><label for="' . $label . '">' . __("Password:") . ' <input name="post_password" id="' . $label . '" type="password" size="20" /></label> <input type="submit" name="Submit" value="' . esc_attr__("Submit") . '" /></p>
    </form>
    <p>' . __("Lost or forgotten password?  Please email vicepresident@williamsburgrowing.org") . '</p>
    	';
    	return apply_filters('the_password_form', $output);
    }

Viewing 1 replies (of 1 total)
  • Thread Starter Thomasjohnwallin

    (@thomasjohnwallin)

    I tried stepping in and out of the php, but still got an error:

    function get_the_password_form() {
    	$post = get_post();
    	$label = 'pwbox-' . ( empty($post->ID) ? rand() : $post->ID );
    	$output = '<form action="' . esc_url( site_url( 'wp-login.php?action=postpass', 'login_post' ) ) . '" method="post">
    	<p>' . __("This post is for FWR members only. To gain access, please") .' ?><a title="Subscriptions" href="http://williamsburgrowing.org/for-donors/subscriptions/">subscribe.</a><?php </p>
    <p>' . __( Existing members, enter your password below:") . '</p>
    	<p><label for="' . $label . '">' . __("Password:") . ' <input name="post_password" id="' . $label . '" type="password" size="20" /></label> <input type="submit" name="Submit" value="' . esc_attr__("Submit") . '" /></p>
    </form>
    <p>' . __("Lost or forgotten password?  Please email ") .' ?><a href="mailto:vicepresident@williamsburgrowing.org">vicepresident@williamsburgrowing.org</a> <?php </p>
    	';
    	return apply_filters('the_password_form', $output);
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Adding a link to Password Protection Text in the post-template.php’ is closed to new replies.