Crystal Theme Portfolio Page

Community Forums Forums General Discussion Crystal Theme Portfolio Page

This topic is: not resolved

This topic contains 7 replies, has 2 voices, and was last updated by  ikegordon 1 year, 11 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #40440

    ikegordon
    Participant

    Would anyone have any suggestions on how to add a slide deck to the top of the portfolio page for the Crystal theme? http://demo.studiopress.com/crystal/templates/my-portfolio

    I’m assuming I would need to edit the code in the Portfolio Page Template (page_portfolio.php)?

    Here is the code for this page template:

    </code></code>
    <p class="p1"><?php</p>
    <p class="p2"></p>
    <p class="p1">// Template Name: Portfolio</p>
    <p class="p2"></p>
    <p class="p1">// Force layout to full-width-content</p>
    <p class="p1">add_filter('genesis_pre_get_option_site_layout', 'crystal_home_layout');</p>
    <p class="p1">function crystal_home_layout($layout) {</p>
    <p class="p1">    $layout = 'full-width-content';</p>
    <p class="p1">    return $layout;</p>
    <p class="p1">}</p>
    <p class="p2"></p>
    <p class="p1">// Add .teaser class to every post, except first 2</p>
    <p class="p1">add_filter('post_class', 'portfolio_post_class');</p>
    <p class="p1">function portfolio_post_class( $classes ) {</p>
    <p class="p1">    $classes[] = 'portfolio';</p>
    <p class="p1">    return $classes;</p>
    <p class="p1">}</p>
    <p class="p2"></p>
    <p class="p1">// Modify length of post excerpts</p>
    <p class="p1">add_filter('excerpt_length', 'custom_excerpt_length');</p>
    <p class="p1">function custom_excerpt_length($length) {</p>
    <p class="p1">    return 15; // pull first 15 words</p>
    <p class="p1">}</p>
    <p class="p2"></p>
    <p class="p1">// Add "View project" link</p>
    <p class="p1">add_filter('the_excerpt', 'child_homepage_excerpt_filter');</p>
    <p class="p1">function child_homepage_excerpt_filter( $text ) {</p>
    <p class="p1">    return sprintf( '%s<a href="%s" class="more-link">%s</a>', $text, get_permalink(), __('View Project', 'crystal') );</p>
    <p class="p1">}</p>
    <p class="p2"></p>
    <p class="p1">// Remove post info and meta info</p>
    <p class="p1">remove_action('genesis_after_post_content', 'genesis_post_meta');</p>
    <p class="p1">remove_action('genesis_before_post_content', 'genesis_post_info');</p>
    <p class="p2"></p>
    <p class="p1">// Move title above post image</p>
    <p class="p1">remove_action('genesis_post_title', 'genesis_do_post_title');</p>
    <p class="p1">add_action('genesis_post_content', 'genesis_do_post_title', 9);</p>
    <p class="p2"></p>
    <p class="p1">// Remove default content for this Page Template</p>
    <p class="p1">remove_action('genesis_post_content', 'genesis_do_post_image');</p>
    <p class="p1">remove_action('genesis_post_content', 'genesis_do_post_content');</p>
    <p class="p2"></p>
    <p class="p1">// Add Featured Image for the Portfolio posts in this Page Template</p>
    <p class="p1">add_action('genesis_post_content', 'crystal_portfolio_do_post_image');</p>
    <p class="p1">function crystal_portfolio_do_post_image() {</p>
    <p class="p1">    $img = genesis_get_image( array( 'format' => 'html', 'size' => 'Portfolio Thumbnail', 'attr' => array( 'class' => 'alignnone post-image' ) ) );</p>
    <p class="p1">    printf( '<a href="%s" title="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), $img );</p>
    <p class="p1">}</p>
    <p class="p2"></p>
    <p class="p1">// Add Content for the Portfolio posts in this Page Template</p>
    <p class="p1">add_action('genesis_post_content', 'crystal_portfolio_do_post_content');</p>
    <p class="p1">function crystal_portfolio_do_post_content() {</p>
    <p class="p2"></p>
    <p class="p1">    if ( genesis_get_option('crystal_portfolio_content') == 'excerpts' ) {</p>
    <p class="p1">        the_excerpt();</p>
    <p class="p2"></p>
    <p class="p1">    } else {</p>
    <p class="p1">        if ( genesis_get_option('crystal_portfolio_content_archive_limit') )</p>
    <p class="p1">            the_content_limit( (int)genesis_get_option('crystal_portfolio_content_archive_limit'), __('View Project', 'crystal') );</p>
    <p class="p1">        else</p>
    <p class="p1">            the_content(__('View Project', 'crystal'));</p>
    <p class="p1">    }</p>
    <p class="p1">}</p>
    <p class="p2"></p>
    <p class="p1">// Clear float using genesis_custom_loop() $loop_counter variable</p>
    <p class="p1">// Outputs clearing div after every 4 posts</p>
    <p class="p1">// $loop_counter is incremented after this function is run</p>
    <p class="p1">add_action('genesis_after_post', 'portfolio_after_post');</p>
    <p class="p1">function portfolio_after_post() {</p>
    <p class="p1">    global $loop_counter;</p>
    <p class="p2"></p>
    <p class="p1">    if ( $loop_counter == 3 ) {</p>
    <p class="p1">        $loop_counter = -1;</p>
    <p class="p1">        echo '<div class="clear"></div>';</p>
    <p class="p1">    }</p>
    <p class="p1">}</p>
    <p class="p2"></p>
    <p class="p1">// Remove standard loop</p>
    <p class="p1">remove_action('genesis_loop', 'genesis_do_loop');</p>
    <p class="p2"></p>
    <p class="p1">// Add custom loop</p>
    <p class="p1">add_action('genesis_loop', 'portfolio_loop');</p>
    <p class="p1">function portfolio_loop() {</p>
    <p class="p1">    $paged = get_query_var('paged') ? get_query_var('paged') : 1;</p>
    <p class="p2"></p>
    <p class="p1">    $include = genesis_get_option('crystal_portfolio_cat');</p>
    <p class="p1">    $exclude = genesis_get_option('crystal_portfolio_cat_exclude') ? explode(',', str_replace(' ', '', genesis_get_option('crystal_portfolio_cat_exclude'))) : '';</p>
    <p class="p2"></p>
    <p class="p1">    $cf = genesis_get_custom_field('query_args'); // Easter Egg</p>
    <p class="p1">    $args = array('cat' => $include, 'category__not_in' => $exclude, 'showposts' => genesis_get_option('crystal_portfolio_cat_num'), 'paged' => $paged);</p>
    <p class="p1">    $query_args = wp_parse_args($cf, $args);</p>
    <p class="p2"></p>
    <p class="p1">    genesis_custom_loop( $query_args );</p>
    <p class="p1">}</p>
    <p class="p2"></p>
    <p class="p1">genesis();</p>
    
    <code class="plain plain">


    Isaac J Gordon
    Isaac@three12design.com

    http://demo.studiopress.com/crystal/templates/my-portfolio
    #40473

    braddalton
    Participant

    Specifically, which slide deck are you referring to?

    You can hook it in using a custom widget. The code below has been tested on the Crystal child theme.

    Or hook in the slider directly if it offers a PHP tag or shortcode:

    Copy this PHP code using the view raw link and paste it at the end of your child themes functions file using a text editor like Notepad++.


    #40474

    ikegordon
    Participant

    Well, that worked like a charm! I’m still very new to PHP. THANK YOU. If I wanted to affect this custom widget using CSS what tag would I use? For instance, I would like to center this widget on the page and add a bit of space between it and the below content.

    Thank you again!


    Isaac J Gordon
    Isaac@three12design.com

    #40475

    ikegordon
    Participant

    My apologies. For anyone interested, this was for Slide Deck 2. However, I’m sure you could use this to add in any sort of widget in the custom widgeted area.


    Isaac J Gordon
    Isaac@three12design.com

    #40477

    braddalton
    Participant

    Use custom-widget as your selector.

    Why not add the slider first and then style it?

    Please link to it once you have.


    #40478

    ikegordon
    Participant

    Please, forgive. Still trying to wrap my head around this. I don’t think I need to style it actually. Right now it’s floated to the left. How can I center it on the portfolio page. I’m sure it’s something very easy I’m missing.


    Isaac J Gordon
    Isaac@three12design.com

    #40479

    braddalton
    Participant

    I would need to inspect the element using Firebug so would need the link to the page please.


    #40480

    ikegordon
    Participant

    Here you are! http://www.rockincleveland.com/our-fleet/


    Isaac J Gordon
    Isaac@three12design.com

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

You must be logged in to reply to this topic.