How do I a link to the Password Protected text? (5 posts)

  1. Thomasjohnwallin
    Posted 3 years ago #

    Using this I was able to update my pw protection text to what I wanted by modifying the functions.php.
    However, I want to include a link. Whenever I try to put one in the appropriate functions.php using html code for <a title="Donate Online" href="http://williamsburgrowing.org/for-donors/donate-online/">subscribe or donate.</a>, it doesn't work and spits back an error . What do I have to do?

    For example:

    I want the phrase "subscribe or donate" to be a link that takes people to this page: http://williamsburgrowing.org/for-donors/donate-online/

    Any help would be greatly appreciated.

  2. Thomasjohnwallin
    Posted 3 years ago #


  3. Bill
    Posted 3 years ago #

    Did you step out of your php code before the html link and then back in again? For example:

    <?php a bunch of php code here... (and close the php tag) ?><a href="the-web-address" >the clickable text</a><?php (start back up with more php...)

  4. Thomasjohnwallin
    Posted 3 years ago #

    I tried that but there is still an error, can you be more explicit?

    Here is the code I used:

    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>
    <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);
  5. Bill
    Posted 3 years ago #

    Sorry Thomas, but I haven't looked at or used that pwd protect form before. My comment was just a general note about mixing html and php. Seems to be a stickler for lots of folks, myself included.

    I may take a look later if I can, but for now I'd offer this: there seems to be a missing double-quote before 'Existing members' on line 6 above. Add that and see what changes for you. Those pesky quote marks love to throw their weight around. Hopefully someone who really knows their stuff will notice this thread and fix you up. Good luck!

Topic Closed

This topic has been closed to new replies.

About this Topic