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.