Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #439985

    I have the latest version of wordpress and Enfold. I have a page that uses a custom template (it’s a survey) and we need it to be password protected. I have it marked as password protected within the page but it is not working. Is there some code I need to add to the template .php file to get it to see that it is password protected? It is not a template that was built in Enfold with the template builder.

    Thanks for your help!

    #440552

    Hey cybervise13!

    Are you using the_title, the_excerpt, or the_content functions in the template? That is how WordPress changes the content, https://codex.wordpress.org/Using_Password_Protection.

    Cheers!
    Elliott

    #440581
    get_header(); 
    
    if( get_post_meta(get_the_ID(), 'header', true) != 'no') echo avia_title();?>
    <div class='container_wrap container_wrap_first main_color <?php avia_layout_class( 'main' ); ?>'>
    			<div class='container'>
    				<main class='template-page content  <?php avia_layout_class( 'content' ); ?> units' <?php avia_markup_helper(array('context' => 'content','post_type'=>'page'));?>>
    
    <div id="container" class="one-column">
    	<div id="content" role="main">
    

    That is what the content is wrapped in. What do I need to get the password protection to work? thanks for helping.

    #440586

    The title is saying protected but it does not ask for the password to see the content, just goes straight to the content. I have checked this while being logged out and cache cleared to confirm it is not that too.

    #441544

    Hey!

    I think you could achieve it easily with a plugin like:
    https://wordpress.org/plugins/smart-passworded-pages/
    https://wordpress.org/plugins/password-protected/

    Best regards,
    Andy

    #441642

    The url used to direct people to this password protected page is on print material, your theme was applied recently and it stopped working. I can’t take them to another page first which is how the first plug-in works. The second one you suggested will password protect the site itself, not individual pages. I have looked through documentation and support forums on how to get the password protection to work with a custom template but every piece of code I have tried is not working with this theme. If you needed to password protect a custom template in your Enfold theme, how would you do it? The standard wordpress password protection is not working. I gave the code as to how it is wrapped, is there something that should be different or modified there? Please advise,
    thank you

    #442256

    Hi!

    Can you please provide the custom template code on pastebin.com? We would like to check it. This is the code needed in order to check if the page is password protected: https://codex.wordpress.org/Function_Reference/post_password_required

    Regards,
    Ismael

    #442500
    This reply has been marked as private.
    #442503

    I will try adding that in and see if that does anything.

    #442919

    Hi!

    Please get back to us if you have any luck with it or not.

    Regards,
    Rikard

    #443107

    not working. I have tried every combo on every forum. Every time I add something it tells me there is a syntax error in this line
    <main class='template-page content <?php avia_layout_class( 'content' ); ?> units' <?php avia_markup_helper(array('context' => 'content','post_type'=>'page'));?>>

    I am not a php programmer so I don’t know what the error is. It doesn’t like the mark-up. Please look at my post on pastebin and advise. We use this theme a lot and have several of our customers that we recommend this to and purchase it frequently, we need to know that we can add a custom template if need be and the password protection actually work.

    #444016

    you can close this ticket, had errors corrected

    #444230

    Hey!

    Great, glad you got it fixed :)

    Regards,
    Rikard

Viewing 13 posts - 1 through 13 (of 13 total)
  • The topic ‘Custom Template file password protection not working’ is closed to new replies.