Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #5318

    Hi,

    I’m trying to bring in 4 items from the portfolio in a row on the homepage. So far I have done it by creating a new php page and calling it on homepage. The code I added into this page was:

    <div class="divider"></div>

    <div class="hometitlewrapper">
    <div class="hometitle">
    <h2>Recent Work</h2>
    </div>
    <div class="hometitledesc">
    <p>You can view more of our recent work in our <a href="#">Portfolio</a> section.</p>
    </div>
    </div>

    <?php
    global $avia_config;
    if(isset($avia_config['new_query'])) { query_posts($avia_config['new_query']); }

    // check if we got a page to display:
    if (have_posts()) :

    $loop_counter = 1;
    $extraClass = 'first';

    $grid = 'grid4';
    $image_size = 'page';
    $showcaption = true;
    $hr_class = "hr";

    switch($avia_config['portfolio_columns'])
    {
    case 1: $grid = 'grid12'; $image_size = 'page'; if(isset($avia_config['remove_portfolio_text'])) $image_size = 'featured'; break;
    case 2: $grid = 'grid6'; $image_size = 'portfolio2'; break;
    case 3: $grid = 'grid4'; $image_size = 'portfolio3'; break;
    case 4: $grid = 'grid3'; $image_size = 'portfolio'; $showcaption = false; break;
    }

    //iterate over the posts
    while (have_posts()) : the_post();

    ?>

    <?php

    $loop_counter++;
    $extraClass = "";
    if($loop_counter > $avia_config['portfolio_columns'])
    {
    $loop_counter = 1;
    $extraClass = 'first';
    echo "";
    }

    endwhile;
    else:
    ?>

    <div class="entry">
    <h1 class='post-title'><?php _e('Nothing Found', 'avia_framework'); ?></h1>
    <p><?php _e('Sorry, no posts matched your criteria', 'avia_framework'); ?></p>
    </div>

    <?php
    endif;

    if($loop_counter != 1){ echo ""; }

    if(!isset($avia_config['remove_pagination'] ))
    echo avia_pagination();
    ?>

    <?php

    global $avia_config;

    //set a deafult query with all portfolio items in case the user just selected to display the page tempalte instead of setting up a portfolio properly
    if(!isset($avia_config['new_query']['tax_query'][0]['terms'][0]) || $avia_config['new_query']['tax_query'][0]['terms'][0] == "null")
    {
    if(!isset($avia_config['portfolio_item_count'])) $avia_config['portfolio_item_count'] = '4';

    $avia_config['new_query'] = array("paged" => get_query_var( 'paged' ), "posts_per_page" => $avia_config['portfolio_item_count'], "post_type"=>"portfolio");
    }
    ?>

    <!-- ####### MAIN CONTAINER ####### -->
    <div class='container_wrap' id='main'>

    <div class='container'>

    <div class='home_portfolio_row'>

    <?php

    /* Run the loop to output the posts.
    * If you want to overload this in a child theme then include a file
    * called loop-portfolio.php and that will be used instead.
    */

    get_template_part( 'includes/loop', 'portfolio' );

    ?>

    <!--end content-->
    </div>

    </div><!--end container-->

    </div>
    <!-- ####### END MAIN CONTAINER ####### -->

    …and while it shows up how I want, the image sizes get messed up and shortened. Also when the page refreshes, the images load normal size, then get cut down to about 80px. Any ideas?

    #49689

    Hey,

    you can build a portfolio template by using the template builder (Brightbox > Template Builder in the admin panel). You can select a 1, 2 ,3 or 4 column setup.

    #49690

    Got it. Thanks.

    #49691

    Glad that I could help you :)

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Way to bring latest 4 portfolio items to homepage?’ is closed to new replies.