Change Crystal Portfolio to use Custom Post Type

Community Forums Forums Design Tips and Tricks Change Crystal Portfolio to use Custom Post Type

This topic is: resolved

This topic contains 2 replies, has 1 voice, and was last updated by  ZeroGravity 1 year, 5 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #24893

    ZeroGravity
    Participant
    Post count: 9

    I would like to change the Crystal Portfolio to use a Custom Post Type. I gather changes will need to be made to the portfolio_loop() function at the end of page_portfolio.php just not 100% sure exactly what.

    It would be ideal to change the meta box in the Genesis Theme settings but that would just be bonus points. I am fine hard coding settings in the portfolio_loop() function for now.

    Does anyone have suggestions on what I should change.

    Many Thanks


    Darren Burns
    Zero Gravity Web Works

    #24900

    ZeroGravity
    Participant
    Post count: 9

    Always the way. Just after I post the question I find the answer that has been staring me in the face the whole time and it seems so simple. I’m not sure if this is correct or best practice but I changed the $args assignment in portfolio_loop() to:

    [php]$args = array(‘post_type’ => ‘photo_competition’, ‘category__not_in’ => $exclude, ‘showposts’ => genesis_get_option(‘crystal_portfolio_cat_num’), ‘paged’ => $paged);[/php]

    If this isn’t the correct way to do it or if there is a better way please let me know. I’m assuming the category__not_in parameter and custom field query_args option will also function. I haven’t tested those yet.

    Also if any one knows how to change the theme settings meta box to be able to select a custom post type that would be great.


    Darren Burns
    Zero Gravity Web Works

    #29478

    ZeroGravity
    Participant
    Post count: 9

    This is what I finally ended up with. I’m still open to any suggestions as to whether there is a better way to do this.

    [php]add_action(‘genesis_loop’, ‘photo_competition_loop’);
    function photo_competition_loop() {
    $paged = get_query_var(‘paged’) ? get_query_var(‘paged’) : 1;

    $cf = genesis_get_custom_field(‘terms’);
    $args = array(    ‘post_type’ => ‘mmt_photo_comp’,
    ‘tax_query’ => array(
    array(
    ‘taxonomy’ => ‘mmt_photo_categories’,
    ‘field’ => ‘id’,
    ‘terms’ => $cf
    )
    ),
    ‘showposts’ => genesis_get_option(‘crystal_portfolio_cat_num’),
    ‘paged’ => $paged
    );
    $query_args = wp_parse_args($cf, $args);

    genesis_custom_loop( $query_args );
    }[/php]


    Darren Burns
    Zero Gravity Web Works

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

You must be logged in to reply to this topic.