Support » Plugin: Client Portal - Private user pages and login » Change Default Title

  • Resolved d3d5x1

    (@deraxia)


    Default page title is username, can this be customized?

    E.g. instead of page title being:

    User1
    User2

    Can become:

    User1’s Page
    User2’s Page

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter d3d5x1

    (@deraxia)

    Or actually, maybe better question, how do I select the default page template for the private pages? I am using default WP theme TwentyTwenty. I don’t see the option anywhere in the plugin.

    • This reply was modified 2 years, 11 months ago by d3d5x1.
    Thread Starter d3d5x1

    (@deraxia)

    Sorry to repeat post, the forum doesn’t let me edit and I am figuring out more and refining what I am trying to do. Basically, I want instead of every page only being titled the user’s display name, it’s titled like “Welcome $display_name!”

    Then, if I could also know how to use the single-private custom template correctly, that would be nice, but the first issue is my biggest concern.

    Awesome plugin, and I appreciate any assistance.

    • This reply was modified 2 years, 11 months ago by d3d5x1.
    Thread Starter d3d5x1

    (@deraxia)

    I’ve been reading the older posts and found the typical solution:

    `Here is how the Client Portal private page template works:
    If your theme has a single-private-page.php file in the theme’s root folder, then that one is used.

    If there is no such file in your theme’s root folder, then single.php is used.
    That is your post template, and you probably don’t want that.

    So the way out of this is to create a single-private-page.php file that has the exact same content as the page.phpfile. That’s your page template.

    Making the long story short, you simply need to duplicate your theme’s page.php and name it single-private-page.php

    If you page.php has a sidebar, you have to modify it in your template.

    I hope this makes quite a lot of sense.`

    But this doesn’t work on TwentyTwenty. TwentyTwenty has no page.php. I made a duplicate of the singular and some other ones, renamed them single-private-page.php and put them in the top level folder but it doesn’t make any difference.

    Hello @deraxia,

    Thank you for reaching out to us.

    Ideally you would make a custom ChildTheme for TwentyTwenty.

    https://developer.wordpress.org/themes/advanced-topics/child-themes/

    Then duplicate the single.php and rename it to single-private-page.php

    https://developer.wordpress.org/themes/basics/template-hierarchy/

    This would have to be inside the newly created childtheme.

    After that, you’ll need to modify this new page to fit your needs. The problem is that it’s not straight forward and if you’re not sure how to do this you’ll need a developer to help you with. Unfortunately what you need requires custom code.

    Have a great day!

    Kind regards,

    Thread Starter d3d5x1

    (@deraxia)

    Thanks for the reply. I figured out how to do it. I suspect this is a common problem for others since splitting up the template parts is increasingly common. Then, the only problem I had was although I have the private page template, the Client Portal plugin doesn’t let me select this as the page template. I figured out how to solve this too.

    For anyone else with the issue:

    How to make custom private page

    1. Figure out the template folder for your theme. For TwentyTwenty, it’s /templates.

    2. Make a duplicate of the template you want, rename it to something easy to identify, like “template-private” and open it up and see if it has all the loop in there or it calls another part. In TwentyTwenty, it calls get_template_part( ‘singular’ );.

    3. I changed “singular” to “singular-private”, then I made a duplicate of the singular file, which is in root, and renamed it to match.

    4. I opened singular-private I made and see if it has the loop in there or it calls another part, if it calls another part, you just repeat until you reach the file that has the loop.

    5. Once you get to the file that has the loop, you make a duplicate of it, and in your duplicate, you can find the H1 and change the title.

    How to load custom private page

    Go to client portal plugin folder and open index.php.

    On line 424, it checks if your theme has “page.php” to decide if you get the post or page option. Of course many themes, like TwentyTwenty, do not have page.php. Remove the line “if ( file_exists( $template_directory . ‘/page.php’ ) )”.

    Then, line 298 is pointing to page.php

    “$template = get_template_directory() . ‘/page.php’;”

    Change to your file you made earlier:

    $template = get_template_directory() . ‘/templates/single-private-page.php’;

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Change Default Title’ is closed to new replies.