• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

inserting a taxonomy archive page from post

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

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

This topic is: not resolved

Tagged: archive, Custom Post Type, featured images, images, taxonomies, taxonomy

  • This topic has 1 reply, 2 voices, and was last updated 11 years, 3 months ago by Susan.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • October 25, 2013 at 2:17 pm #68904
    thoughtwell
    Member

    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();

    http://localhost
    February 12, 2014 at 7:31 pm #90064
    Susan
    Moderator

    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!

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble