- This topic has 2 replies, 2 voices, and was last updated 9 years, 7 months ago by Theme Horse Support Team.
-
AuthorPosts
-
April 8, 2015 at 8:41 pm #23879shawnhoffmanParticipant
Working in a child theme of course…
I have registered the widget by copying the contact sidebar and registering mine changing contact -> right.
// Registering right Page sidebar register_sidebar( array( 'name' => __( 'Right Page Sidebar', 'attitude' ), 'id' => 'attitude_right_page_sidebar', 'description' => __( 'Shows widgets on Right Page Template.', 'attitude' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' ) );
That part works fine, and in widgets it shows up and I can add it. Now I want that to show up on a new page “Right” as well.
So, I copied the contact page_template_contact.php and created page_template_right.php changing all instances of contact -> right again.
I did the same with sidebar_contact_page.php -> sidebar_right_page.php
I also added this function:
/****************************************************************************************/ add_action( 'attitude_right_page_sidebar', 'attitude_display_right_page_sidebar', 10 ); /** * Show widgets on Right Page Template's sidebar. * * Shows all the widgets that are dragged and dropped on the Right Page Sidebar. */ function attitude_display_right_page_sidebar() { // Calling the right page sidebar if it exists. if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar( 'attitude_right_page_sidebar' ) ): endif; } /****************************************************************************************/
What am I doing wrong, and what is missing? The page exists, but it doesn’t show any content. It should be here:
http://www.mejoringles.es/translations/.Thanks in advance.
April 8, 2015 at 10:00 pm #23880shawnhoffmanParticipantWell – one “solution” was to use either the “Easy Custom Sidebars” or the “Custom Sidebars” plugins (the 2nd one being a bit more powerful). That is enough to “solve” my issue, but I would still like to know how to do it manually and think that it MUST be possible since a plugin is only doing the manual work automatically.
So, I guess there is no ‘hurry’ on this, but if anyone feels like answering me just for the sake of learning, that would be awesome and I will give you a virtual high five and wink.
-Shawn
April 9, 2015 at 5:16 am #23894Theme Horse Support TeamKeymasterHi shawnhoffman,
Yes create a sidebar_right_page.php on the theme folder of your child theme. Its great. Then after doing it you change the template name
e.g:-<?php /** * Template Name: Contact Page Template right * * Displays the contact page template right. * * @package Theme Horse * @subpackage Attitude * @since Attitude 1.0 */ ?> <?php get_header(); if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar( 'attitude_right_page_sidebar' ) ): endif; get_footer(); ?>
After doing it your template file is created. Select this page template (Contact Page Template right) from pages and now your widgets is called.
Thank you!
-
AuthorPosts
- You must be logged in to reply to this topic.