• 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

How create a new template for a static events-page?

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 › General Discussion › How create a new template for a static events-page?

This topic is: not resolved

Tagged: Sidebar, standard-template

  • This topic has 5 replies, 2 voices, and was last updated 6 years, 2 months ago by Dan-cer.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • July 17, 2017 at 7:04 am #209210
    Dan-cer
    Member

    Hi,
    I want to create a new template for a static page and use it for display of events.
    Since the editing of the events-page (plugin: The Events Calendar) doesn't allow to select an individual sidebar, I either get the standard sidebar that I choosed for my blog-page or I have to create another static-page template, that has no blog-posts. Then I can select this template for the events-plugin.

    I'm still not familiar with the hook-system of genesis. And I couldn't find the right file of the standard-template in my child-theme to copy and customize it.

    So I just need a simple template-code that includes individual sidebar and widget-area in the content-section.

    Could anybody provide this for me?

    Thank you in advance!

    kind regards,
    Rainer

    https://www.test.rainerklar.de
    July 17, 2017 at 4:52 pm #209236
    Marcy
    Participant

    Since you don't code, it will be easier if you just control the widgets in the sidebar, depending on which page you are on.
    There are many ways to do this. If you have Jetpack, you can use the Visibility module.
    You can read about how it works here:

    Hide Sidebar Widgets on WordPress Pages and Posts

    If you want to use a really powerful plugin to control your sidebar content, try Content Aware Sidebars - https://wordpress.org/plugins/content-aware-sidebars/


    Marcy | Amethyst Website Design | Twitter

    July 17, 2017 at 11:58 pm #209247
    Dan-cer
    Member

    Thank you Marcy, the Content Aware Sidebars are exactly what can serve my needs in an easy way!

    Since I'm using Genesis Simple Sidebars already, I want to know:
    Could I use both plugins parallel?
    With Simple Sidebars I created already 20 Sidebars and don't to transfer them manually to the new plugin.

    July 18, 2017 at 10:31 am #209272
    Marcy
    Participant

    I don't know if you can use both plugins together.
    Go ahead and install Content Aware Sidebars, and see what happens.

    But if I had 20 sidebars, and needed more control over them than Simple Sidebars gives (on a per post or per page basis), I would take the time to redo them, so that they worked the way I wanted going forward.


    Marcy | Amethyst Website Design | Twitter

    July 18, 2017 at 10:47 am #209273
    Dan-cer
    Member

    Yes, Marcy, you are most probably right. And now I come again to the point just to get a template for a static page, with the features I have already for custom blog pages.
    These features are widget areas on top of blog posts. I give you an example belowe.
    the only thing I have to change is avoid to start the loop with blog-posts.
    Just a static page with a widget area before content, after header, and with a custom sidebar.
    With such a template I am free to get the dynamic event-widget on top of the page, automatically refreshing the events.

    Here is the code of one of my individual blog-pages:

    <?php
    /**
    * Template Name: Medien
    */
    add_filter( 'body_class', 'ernaehrung_body_class' );
    function ernaehrung_body_class( $classes ) {
    
    	$classes[] = 'medien';
    	return $classes;
    }
    
    add_action( 'genesis_before_loop', 'before_loop_widget_medien' );
    	
    function before_loop_widget_medien() {
    
    	genesis_widget_area( 'before-loop-medien', array(
    		'before' => '<div class="before-loop-medien entry"><div class="widget-area"><div class="wrap">',
    		'after'  => '</div></div></div>',
    	) );
    
    }
    
    remove_action( 'genesis_loop', 'genesis_do_loop' );
    add_action( 'genesis_loop', 'child_do_custom_loop' );
     
    function child_do_custom_loop() {
     
        global $paged; // current paginated page
        global $query_args; // grab the current wp_query() args
        $args = array(
            'category_name' => 'medien', // exclude posts from this category
            'paged'            => $paged, // respect pagination
        );
     
        genesis_custom_loop( wp_parse_args($query_args, $args) );
     
    }
    
    add_action( 'genesis_after_loop', 'after_loop_widget_medien' );
    
    function after_loop_widget_medien() {
    
    	genesis_widget_area( 'after-loop-medien', array(
    		'before' => '<div class="after-loop-medien entry"><div class="widget-area"><div class="wrap">',
    		'after'  => '</div></div></div>',
    	) );
    
    }
    
    genesis();

    How is this code to modify to avoid the loop of the blog-posts?

    Thank you for your answer!

    kind regards,
    Rainer

    July 23, 2017 at 11:56 am #209489
    Dan-cer
    Member

    Hi there,

    the Content Aware Sidebars are great, and I'm using the plugin now.

    I still need the right hooks for a static page. As I wrote above this static page should have widget areas on top, middle and bottom of content, like the category-template I showed there.

    But it shoudn't have loop/posts on that static template. Instead of posts just space for any content.

    I tried already to get the right code, but up to now I failed.
    Here is an example:

    <?php
    /**
    * Template Name: Seminare
    */
    add_filter( 'body_class', 'seminare_body_class' );
    function seminare_body_class( $classes ) {
    
    	$classes[] = 'seminare';
    	return $classes;
    }
    
    remove_action( 'genesis_loop', 'genesis_do_loop' );
    add_action( 'genesis_before_entry', 'genesis_entry_content' );
    function genesis_entry_content() 
    {
    	seminar-sidebar( 'we-seminar-am' );
    }
    
    genesis();

    Can anybody show me a useful code? I'm irritated that I can't find the standard-template within my theme. I googled it, but didn't find the code of that template.

    Thank you in advance for your answers.

    kind regards,
    Rainer

  • Author
    Posts
Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘General Discussion’ 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

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