Community Forums › Forums › Archived Forums › General Discussion › How create a new template for a static events-page?
Tagged: Sidebar, standard-template
- This topic has 5 replies, 2 voices, and was last updated 7 years, 8 months ago by
Dan-cer.
-
AuthorPosts
-
July 17, 2017 at 7:04 am #209210
Dan-cer
MemberHi,
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,
https://www.test.rainerklar.de
RainerJuly 17, 2017 at 4:52 pm #209236Marcy
ParticipantSince 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: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 #209247Dan-cer
MemberThank 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 #209272Marcy
ParticipantI 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 #209273Dan-cer
MemberYes, 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,
RainerJuly 23, 2017 at 11:56 am #209489Dan-cer
MemberHi 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 -
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.