@<?php 
get_header();
get_template_part('portfolio_header');
//global $paged;
$term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
if (get_query_var('paged')) {
    $paged = get_query_var('paged');
} elseif (get_query_var('page')) {
    $paged = get_query_var('page');
} else {
    $paged = 1;
}
$pageId = $_SESSION['Alcatron_page_id'];
if (!$pageId) {
    $pageId = get_page_ID_by_page_template('portfolio-template-3columns.php');
}
$custom = get_post_custom($pageId);
$layout = isset($custom['_page_layout']) ? $custom['_page_layout'][0] : '1';
$items_per_page = isset($custom['_page_portfolio_num_items_page']) ? $custom['_page_portfolio_num_items_page'][0] : '777';
global $wp_query;
$temp = $wp_query;
$wp_query = null;
$wp_query = new WP_Query(array('taxonomy' => 'portfolio_category', 'term' => $term->slug, 'post_type' => 'portfolio', 'posts_per_page' => $items_per_page, 'paged' => $paged, 'showposts' => $items_per_page));
$alc_options = get_option('alc_general_settings');
$breadcrumbs = $alc_options['alc_show_breadcrumbs'];
$titles = $alc_options['alc_show_page_titles'];
$page_template_name = get_post_meta($_SESSION['Alcatron_page_id'], '_wp_page_template', true);
$itemsize = 'large-block-grid-3';
$thumbsize = 'portfolio-3-col';
switch ($page_template_name) {
function my_option_posts_per_page($value)
{
    global $option_posts_per_page;
    if (is_tax('portfolio_category')) {
        $pageId = get_page_ID_by_page_template('portfolio-template3.php');
        if ($pageId) {
            $custom = get_post_custom($pageId);
            $items_per_page = isset($custom['_page_portfolio_num_items_page']) ? $custom['_page_portfolio_num_items_page'][0] : '777';
            return $items_per_page;
        } else {
            return 4;
        }
    } else {
        return $option_posts_per_page;
    }
}
<?php

/*** Portfolio Single Posts template. */
?>

<?php 
get_header();
$pageId = isset($_SESSION['Alcatron_page_id']) ? $_SESSION['Alcatron_page_id'] : get_page_ID_by_page_template('portfolio-template.php');
$custom = get_post_custom($pageId);
$layout = isset($custom['_page_layout']) ? $custom['_page_layout'][0] : '1';
$alc_options = get_option('alc_general_settings');
$breadcrumbs = $alc_options['alc_show_breadcrumbs'];
$titles = $alc_options['alc_show_page_titles'];
$headline = get_post_meta($post->ID, "_headline", $single = false);
?>
<div class="row">
    <div class="large-12 columns main-content-top">
        <div class="row">
            <div class="large-6 columns">
                <h2><?php 
the_title();
?>
</h2>
            </div>        
            <div class="large-6 columns">
                
                    <?php 
if (class_exists('the_breadcrumb')) {
    $albc = new the_breadcrumb();
}
?>
<?php

/** The template for displaying Archive pages. **/
get_header();
$alc_options = get_option('alc_general_settings');
$breadcrumbs = $alc_options['alc_show_breadcrumbs'];
$titles = $alc_options['alc_show_page_titles'];
$id = get_page_ID_by_page_template('blog-template.php');
$custom = get_post_custom($id);
$layout = isset($custom['_page_layout']) ? $custom['_page_layout'][0] : '1';
$name = get_page_name_by_ID($id);
$promo = get_post_meta($id, "_promo", $single = false);
if (!empty($promo[0])) {
    ?>
	<div class="row content_top promo-block">
		<div class="twelve columns">
			<h2><?php 
    echo do_shortcode($promo[0]);
    ?>
</h2>
		</div>
	</div>
<?php 
}
$headline = get_post_meta($id, "_headline", $single = false);
?>
<div class="row">
    <div class="large-12 columns main-content-top">
        <div class="row">
            <div class="large-6 columns">
                <h2><?php