Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1099024
    tsjobom
    Participant

    Hi,
    I’m using wordpress built in password protection for my portfolio index page, but it’s not showing up. If I change the page to use a different layout it starts working again. Any ideas? I do have a custom my_password_form() function in my child theme’s functions.php.

    #1099462
    Rad
    Moderator

    Hi there,

    Thanks for writing in.

    How do you protect it through functions.php? Would you mind providing the code? How about using the WordPress’ default password protection, it’s located along with publish button (post visibility).

    Thanks!

    #1100064
    tsjobom
    Participant
    This reply has been marked as private.
    #1100358
    Rad
    Moderator

    Hi there,

    Could be that portfolio uses a different template than the standard one.

    Would you mind providing your site’s URL, admin and FTP login credentials in private reply?

    Thanks!

    #1102209
    tsjobom
    Participant
    This reply has been marked as private.
    #1104619
    Lely
    Moderator

    Hi There,

    Thank you for the credentials. Unfortunately, the default Password protect function is working only for the the_content filter. That is how it works by default on WordPress. Layout Portfolio page is not part of that same with the blog page index. See this article for more discussion and explanation:https://digwp.com/2009/08/password-protect-more-than-the_content/ and this:https://codex.wordpress.org/Content_Visibility

    Regretfully this isn’t a feature offered by X. It could be possible with custom development, but this would be outside the scope of support we can offer. You may wish to consult a developer to assist you with this. X is quite extensible with child themes, so there are plenty of possibilities.

    It could be possible by using a 3rd party plugin however we cannot guarantee their compatibility as we do not support 3rd party plugins.

    #1106054
    tsjobom
    Participant

    Hi, thanks for those links, that helped me figure it out.
    For anyone interested, the solution that worked for me was to override /frameworks/views/integrity/template-layout-portfolio.php as follows:

    <?php get_header(); ?>
      <div class="x-container max width offset">
    <?php if ( !post_password_required() ) { ?>
    
        <div class="<?php x_main_content_class(); ?>" role="main">
    
          <?php x_get_view( 'global', '_portfolio' ); ?>
    
        </div>
    
        <?php get_sidebar(); ?>
    
    <?php } else { echo my_password_form(); } ?>
      </div>
    
    <?php get_footer(); ?>
    #1106482
    Lely
    Moderator

    You’re welcome!

    Thank you also for sharing your code.

    Cheers!

  • <script> jQuery(function($){ $("#no-reply-1099024 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>