• Resolved darkan9el

    (@darkan9el)


    Hi all, I’ve been working through this how-to on making a simple client portal: Howto here

    I’ve got up to the part where one has to make a custom template and now I’m totally lost.

    for your information I’m using themify’s Phototouch theme I think its pretty cool and don’t want to change it. So, ?What do I do?

    Questions:

    • I don’t have a “normal page.php” I do have page.php, index.php in the root of the phototouch theme folder so do I choose one of those?
    • Or do I just use BBedit to copy the code into a blank text file and then rename it to client-portal.php
    • Do I need to add in the comments at the very top, “Template Name: ClientPortal” (so wp admin is aware of this new template?) or can I omit this? Also how do I format this please give an example of the code required.
    • When i’ve created my custom page template, where do I put it? in the root of my phototouch theme folder or on the root of the wordpress site? where?
    • I don’t see a Template dropdown when creating a page to be able to choose client-portal or any template.

    I know a lot of this may be obvious to some but to a novice it appears to have assumptions and assumptions mean missing info to complete a task.

    TIA

Viewing 5 replies - 1 through 5 (of 5 total)
  • I’m sorry but as you are using a commercial theme, you need to seek support from the theme’s vendors.
    https://themify.me/forum

    Thread Starter darkan9el

    (@darkan9el)

    I would have thought the creation of a custom template file to be a generic process independent of the theme, I mentioned the theme for informational purposes. The process for the simple client area is ok but omits a lot of basic information and its this I want to clarify.

    In the original howto post tzeldin88 doesn’t mention the theme used so I can’t set this up following their instructions verbatim. I’ll PM tzeldin88 and find out what theme he was talking about so I can at least understand what they were looking at and using.

    In the meantime I’ll pop over to themify and ask how to make a custom page and post it here.

    Thread Starter darkan9el

    (@darkan9el)

    I’ve solved one problem

    I don’t see a Template dropdown when creating a page to be able to choose client-portal or any template.

    This is shown when using Quick Edit in the Pages section.

    • So you would login to your dashboard at https://www.{yourdomainname}.com/wp-admin
    • In Dashboard on the left of the screen, you see a sidebar menu and on the sidebar menu you should see “Pages”, you can either mouse over pages and choose “All Pages” or just click on Pages.
    • In the main panel you should now see a list of your pages and when you mouseover a page in the main panel it will show you a few options like Edit | Quick edit | Trash | View
    • Click on “Quick edit” and you will see multiple settings appear including the section “Template” with default template set. If there is more than one template you can click on the small black triangle to choose a different template.
    Thread Starter darkan9el

    (@darkan9el)

    Found this page on Codex Creating_Your_Own_Page_Templates its well written and easy to understand, hopefully it will help others trying to create a simple client area.

    This pretty much answers my questions and helps me to understand custom template creation, template page placement. the comment and template name plus a whole lot more. Now I can start to experiment and learn.

    Thread Starter darkan9el

    (@darkan9el)

    Just want to add a few source pages and a few tips on the php editing to get it to show properly. Hopefully I’ll get to do a video on how to do this and upload to my youtube account.

    Ok, I’ve already mentioned a few source pages where I got a better understanding and here is one more: Theme_Development – Template_Files_List I read this to understand what I was looking at when I opened the theme folder and in my case the Phototouch theme from Themify.
    In the end I choose the index.php file to base the client-portal.php file on. I should mention here I use Mac so a few keystrokes will be different for Windows users but I’ll put in the Windows alternative too, the windows keystrokes are in brackets.
    I opened index.php from my FTP client (Filezilla) by logging into my sites FTP area and right clicking on the index.php file and choosing View/edit, I pressed CMD+A for Mac or (CTRL+A) for Windows to select all of the php code, then CMD+C (CTRL+C) to copy the php code. Next I opened a text editor, I use BBedit which is excellent; a great alternative for Windows is Notepad++. I created a new text file using File > New and pasted the php code I’d copied earlier into this file.

    Ok adding the code.
    The top of the code we have just pasted looks like this…

    <?php get_header(); ?>
    
    <?php if(is_front_page() & !is_paged()){ get_template_part( 'includes/slider'); } ?>
    
    <?php
    /////////////////////////////////////////////
    // Setup Default Variables
    /////////////////////////////////////////////
    ?>

    You need to put in a few lines to push the code down to make some space to insert the template name code, when done it should look like this…

    <?php
    /*inserted code so wp admin is aware of this new template*/
    
    /*
    Template Name: client-portal
    */
    
    /*end of inserted code*/
    ?>
    
    <?php get_header(); ?>
    
    <?php if(is_front_page() & !is_paged()){ get_template_part( 'includes/slider'); } ?>
    
    <?php
    /////////////////////////////////////////////
    // Setup Default Variables
    /////////////////////////////////////////////
    ?>

    The next bit of code you need to add gets inserted lower down the page, so in my case I scrolled down to…

    /////////////////////////////////////////////
    		// Default query categories
    		/////////////////////////////////////////////
    		?>
    		<?php $query_cats = themify_get('setting-default_query_cats'); ?>
    		<?php if(($query_cats !="") && !is_search()): ?>
    			<?php query_posts($query_string . '&cat='.$query_cats); ?>
    		<?php endif; ?>
    
    		<?php
    		/////////////////////////////////////////////
    		// Loop
    		/////////////////////////////////////////////
    		?>
    		<?php if (have_posts()) : ?>
    
    			<!-- loops-wrapper -->
    			<div class="loops-wrapper <?php echo $post_layout; ?>">
    
    				<?php while (have_posts()) : the_post(); ?>
    
    					<?php if(is_search()): ?>
    						<?php get_template_part( 'includes/loop' , 'search'); ?>
    					<?php else: ?>
    						<?php get_template_part( 'includes/loop' , 'index'); ?>
    					<?php endif; ?>
    
    				<?php endwhile; ?>
    
    			</div>
    			<!-- /loops-wrapper -->
    
    			<?php get_template_part( 'includes/pagination'); ?>

    tzeldin88 said look for the loop: if (have posts()): ?> this almost worked for me but had the page a bit messed up because the title of the page was below the content, the content being a bit of lipsum text, not really what I wanted. After trying a few different positions I got the title above the lipsum text by pasting it just below: <?php get_template_part( ‘includes/pagination’); ?>
    so the code now looks like this…

    /////////////////////////////////////////////
    		// Default query categories
    		/////////////////////////////////////////////
    		?>
    		<?php $query_cats = themify_get('setting-default_query_cats'); ?>
    		<?php if(($query_cats !="") && !is_search()): ?>
    			<?php query_posts($query_string . '&cat='.$query_cats); ?>
    		<?php endif; ?>
    
    		<?php
    		/////////////////////////////////////////////
    		// Loop
    		/////////////////////////////////////////////
    		?>
    		<?php if (have_posts()) : ?>
    
    			<!-- loops-wrapper -->
    			<div class="loops-wrapper <?php echo $post_layout; ?>">
    
    				<?php while (have_posts()) : the_post(); ?>
    
    					<?php if(is_search()): ?>
    						<?php get_template_part( 'includes/loop' , 'search'); ?>
    					<?php else: ?>
    						<?php get_template_part( 'includes/loop' , 'index'); ?>
    					<?php endif; ?>
    
    				<?php endwhile; ?>
    
    			</div>
    			<!-- /loops-wrapper -->
    
    			<?php get_template_part( 'includes/pagination'); ?>
    
    <?php
    
    /* Inserted php code for client area */
    
    global $current_user;
    get_currentuserinfo();
    $page = get_page_by_title($current_user->user_login);
    _e($page->post_content);
    
    /* end of inserted code for client area */
    
    ?>

    This works pretty much exactly as tzeldin88 intended. I can post the complete client-portal.php code if asked for.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Client area – simple’ is closed to new replies.