inserting a taxonomy archive page from post

Community Forums Forums Design Tips and Tricks inserting a taxonomy archive page from post

This topic is: not resolved

This topic contains 1 reply, has 2 voices, and was last updated by  Susan 10 months, 1 week ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #68904

    thoughtwell
    Participant
    Post count: 12

    For my taxonomy archive page in my theme (genesis 2.0 theme) I have found a way to insert an image based on a function hooked into ‘genesis_after_header’ and it works if you only have one custom post type in the taxonomy. However, when you add more custom post types to this taxonomy, the image goes away, just leaving the page as it would appear as if the function did not exist (in other words, no image at all from either post.)

    The idea is to achieve a featured image for this taxonomy type. The featured image is to be pulled from the first post listed in the loop on that page.

    Can anyone look at this code and suggest a way to do this that will output the featured image from the first post into the taxonomy archive page when you have multiple custom post types in the taxonomy? This has been kind of hacked together w/ my noobish php skill and pulling parts from various online tutorials along other lines that I kinda ‘home-brewed’ into this function that does (sorta) what I would like it to w/ the exception it breaks when more that one post is included in the taxonomy archive page’s loop. Perhaps someone can suggest a more semantic way?

    Code excerpt from my taxonomy archive page, “taxonomy-smt_equipment_family.php”:

    <?php

    /**
    * The Equipment Families Taxonomy Page
    */

    add_action( ‘genesis_after_header’, ‘insert_stage_thumb’);
    function insert_stage_thumb() {
    if(has_post_thumbnail($post->ID)) {
    $image = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), ‘single-post-thumbnail’); ?>
    <div class=”stage_thumb” style=”background: url(‘<?php echo $image[0]; ?>’) no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; width: 100%; height: 400px; height: 40rem;”>
    </div>
    <?php
    }
    }

    /** Remove the post info function */
    remove_action( ‘genesis_before_post_content’, ‘genesis_post_info’ );

    //* Remove the entry meta in the entry header (requires HTML5 theme support)
    remove_action( ‘genesis_entry_header’, ‘genesis_post_info’, 12 );

    /** Remove the author box on single posts */
    remove_action( ‘genesis_after_post’, ‘genesis_do_author_box_single’ );

    /** Remove the post meta function */
    remove_action( ‘genesis_entry_footer’, ‘genesis_post_meta’ );

    /** Remove the comments template */
    remove_action( ‘genesis_after_post’, ‘genesis_get_comments_template’ );

    remove_action( ‘genesis_sidebar’, ‘genesis_do_sidebar’ ); //remove the default genesis sidebar

    add_action( ‘genesis_sidebar’, ‘smtwp_do_sidebar’ ); //add an action hook to call the function for my custom sidebar

    //Function to output my custom sidebar
    function smtwp_do_sidebar() {
    dynamic_sidebar( ‘product-menu’ );
    }

    genesis();

    • This topic was modified 1 year, 1 month ago by  thoughtwell. Reason: clarified problem
    • This topic was modified 1 year, 1 month ago by  thoughtwell. Reason: clarified problem
    http://localhost
    #90064

    Susan
    Moderator
    Post count: 9583

    Since it’s been a while since you posted your question, I hope you got your issue resolved.

    If not, please report back to me, and I will escalate to try to get someone to assist you.

    Thanks!


    Susan @ Graphically Designing I offer theme customizations I tweet!
    I’ve taken up the challenge! – help me answer some of the unanswered posts

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

You must be logged in to reply to this topic.