• 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

Override default archive template

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 › Override default archive template

This topic is: resolved

Tagged: WPAverts

  • This topic has 4 replies, 3 voices, and was last updated 9 years, 2 months ago by photoaddictsa.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • May 31, 2017 at 1:57 am #207196
    photoaddictsa
    Member

    I have no idea if that title was correct but let me explain, this might get lengthy so please bare with me.

    I'm using the plugin WPAdverts, I've been having one particular issue I can't solve, the category pages do not display the ads in that category, see here: http://inthebunch.co.za/classifieds/road/

    After chatting to the plugin developer he came to the following conclusion;

    Hi, it looks like your theme is not 100% compatible with WPAdverts you will need to create a taxoonomy-advert_category.php file for your theme as explained here https://wpadverts.com/documentation/child-themes-and-templates/ in part Custom Taxonomy Template

    According to the instructions, I should create "taxoonomy-advert_category.php" and copy over the content of archive.php and then replace while(have_posts()) ... endwhile; with the following;

    <?php 
        global $wp_query;
        remove_filter("the_content", "adverts_the_content");
        echo shortcode_adverts_list(array(
            "category" => $wp_query->get_queried_object_id()
         ));
     ?>

    I'm a bit new with this one, Genesis advises against editing framework files directly but rather in child theme, my question is how would I go about following his suggestion without having to copy over the archive.php content?

    May 31, 2017 at 6:26 am #207211
    Victor Font
    Moderator

    This is the purpose of child themes. You create the new template and place it in your child theme directory. This overrides anything in the framework if done correctly. You may want to take the time to learn more about the WordPress template hierarchy: https://developer.wordpress.org/themes/basics/template-hierarchy/


    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

    May 31, 2017 at 7:19 am #207215
    photoaddictsa
    Member

    Hi Victor,

    The hierarchy thing I get, it's the "if done correctly" bit I was battling with.

    I had to call the header and footer for the code to end up working.

    <?php 
    /**  
    * Template Name: Custom classifieds Archive
    *
    *    
    */ 
        get_header(); ?>
        
            <?php 
                global $wp_query;
                remove_filter("the_content", "adverts_the_content");
                echo shortcode_adverts_list(array(
                    "category" => $wp_query->get_queried_object_id()
                 ));
             ?>
        
        <?php get_footer(); ?>
    May 31, 2017 at 8:02 am #207218
    Brad Dalton
    Participant

    You could hook it in using a custom function

    add_action( 'your_hook', 'your_function' );
    function your_function() {
    global $wp_query;
    remove_filter( 'the_content', 'adverts_the_content' );
    echo shortcode_adverts_list(array('category' => $wp_query->get_queried_object_id()
    ));
    }
    

    Swap out your_hook in the above code with the genesis hook you want to use.


    Tutorials for StudioPress Themes.

    May 31, 2017 at 8:04 am #207219
    photoaddictsa
    Member

    Never even thought of that one, thanks Brad.

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 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

© 2026 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