ThemeShaper Forums » Thematic

[closed]

Cannot reorder my widgets after adding a new one

(8 posts)
  • Started 2 years ago by retrobou
  • Latest reply from ScottNix
  • This topic is not resolved
  1. I've created a third sidebar widget. I am sure I did it incorrectly, however, it is working as it should....except I cannot seem to reorder it in the admin. Its important to reorder as my client has a habit of messing up layouts badly, so I created these so she will put the correct content in the right place, & I need it to be as easy as possible :).
    Here is my functions.php
    // This will create your widget area
    function my_widgets_init() {
    register_sidebar(array(
    'admin_menu_order' => 201,
    'name' => 'Narrow Right Column 135px',
    'id' => 'widget_area_third_aside',
    'before_widget' => '<li id="%1$s" class="widgetcontainer %2$s">',
    'after_widget' => "\n",
    'before_title' => "<h3 class=\"widgettitle\">",
    'after_title' => "</h3>\n",
    ));

    }
    add_action( 'init', 'my_widgets_init');

    // adding the widget area to your child theme
    function widget_area_third_aside() {
    if ( function_exists('dynamic_sidebar') && is_sidebar_active('widget_area_third_aside') ) {
    echo '<div id="third" class="aside main-aside">'. "\n" . '<ul class="xoxo">' . "\n";
    dynamic_sidebar('widget_area_third_aside');
    echo '' . "\n" . ''. "\n";
    echo '' . "\n" . '</div><!-- #belowmainasides .aside -->'. "\n";
    }
    }
    add_action('thematic_widget_area_third_aside', 'my_sidebar_widgets', 0);

    function rename_widgetized_area($content) {
    $content['Primary Aside']['args']['name'] = 'Wide Sidebar 300px';
    $content['Secondary Aside']['args']['name'] = 'Narrow Left Column 135px';
    return $content;
    }
    add_filter('thematic_widgetized_areas', 'rename_widgetized_area');

    Here is my sidebar.php in my childtheme.

    // action hook for placing content above the main asides
    thematic_abovemainasides();

    // action hook creating the primary aside
    widget_area_primary_aside();

    // action hook for placing content between primary and secondary aside
    thematic_betweenmainasides();

    // action hook creating the secondary aside
    widget_area_secondary_aside();

    // action hook creating the secondary aside
    widget_area_third_aside();

    // action hook for placing content below the main asides
    thematic_belowmainasides();

    And here is a link to the temp url I have applied this to.
    http://174.121.151.252/~italians/

    All is well on the actual site. In the admin, the new widget shows below the Page Bottom widget. I need it directly below the secondary.

    I've copied and pasted so many different things that I am sure I have screwed something up, but like I said, widgets work great, just can't reorder them in the admin.
    Tried to redo it filtering using this thread...
    http://forums.themeshaper.com/topic/something-new-bout-widgetized-areas
    but then its giving me errors, I think the sidebar.php is conflicting that I used....I have a headache and really could use someone elses eyes please?

    Posted 2 years ago #
  2. function my_widgets_init($content) {
            $content['Third Aside'] = array(
    			'admin_menu_order' => 201,
    			'args' => array (
    			'name' => 'Narrow Right Column 135px',
    			'id' => 'widget_area_third_aside',
    			'before_widget' => '<li id="%1$s" class="widgetcontainer %2$s">',
    			'after_widget' => "\n",
    			'before_title' => "<h3 class=\"widgettitle\">",
    			'after_title' => "</h3>\n",
    				),
    			'action_hook'	=> 'widget_area_third_aside',
    			'function'		=> 'thematic_third_aside',
    			'priority'		=> 10,
    			);
    
                  return $content;
    }
    add_filter('thematic_widgetized_areas', 'my_widgets_init');

    http://forums.themeshaper.com/topic/make-new-widget-area-appear-at-top-of-admin-page-list

    Like 90% of other examples around the forums are the one you had. ;P

    Posted 2 years ago #
  3. Thanks for the quick reply....

    That gives me this error...
    Fatal error: Call to undefined function widget_area_third_aside() in /home/italians/public_html/wp-content/themes/italiansoulfood/sidebar.php on line 16

    Here is my sidebar.php

    // action hook for placing content above the main asides
    thematic_abovemainasides();

    // action hook creating the primary aside
    widget_area_primary_aside();

    // action hook for placing content between primary and secondary aside
    thematic_betweenmainasides();

    // action hook creating the secondary aside
    widget_area_secondary_aside();

    // action hook for creating the third aside
    widget_area_third_aside();

    // action hook for placing content below the main asides
    thematic_belowmainasides();

    ....So, I took out the widget area third aside I had put in prior. Now it moved the menu in the admin, but doesn't show on the page. :(

    Posted 2 years ago #
  4. Hmm... using your sidebar and

    // register third sidebar aside
    function my_widgets_init($content) {
    	$content['Third Aside'] = array(
    	'admin_menu_order' => 201,
    		'args' => array (
    		'name' => 'Narrow Right Column 135px',
    		'id' => 'widget_area_third_aside',
    		'before_widget' => '<li id="%1$s" class="widgetcontainer %2$s">',
    		'after_widget' => "\n",
    		'before_title' => "<h3 class=\"widgettitle\">",
    		'after_title' => "</h3>\n",
    		),
    	'action_hook'	=> 'widget_area_third_aside',
    	'function'		=> 'thematic_third_aside',
    	'priority'		=> 10,
    	);
    
    	return $content;
    }
    add_filter('thematic_widgetized_areas', 'my_widgets_init');
    
    // adding the widget area to your child theme
    function widget_area_third_aside() {
    	if ( function_exists('dynamic_sidebar') && is_sidebar_active('widget_area_third_aside') ) {
    		echo '<div id="third" class="aside main-aside">'. "\n" . '<ul class="xoxo">' . "\n";
    		dynamic_sidebar('widget_area_third_aside');
    		echo '' . "\n" . ''. "\n";
    		echo '' . "\n" . '</div><!-- #belowmainasides .aside -->'. "\n";
    	}
    }
    add_action('thematic_widget_area_third_aside', 'my_sidebar_widgets', 0);
    
    // rename widgets in admin
    function rename_widgetized_area($content) {
    	$content['Primary Aside']['args']['name'] = 'Wide Sidebar 300px';
    	$content['Secondary Aside']['args']['name'] = 'Narrow Left Column 135px';
    
    	return $content;
    }
    add_filter('thematic_widgetized_areas', 'rename_widgetized_area');

    Works fine for me, scottnix.com/dev

    Not sure what the deal could be, it sounds like your sidebar.php is in your child theme, I am also using the latest development release of Thematic, but am pretty sure I have used this on the older 9.7.7 version.

    Posted 2 years ago #
  5. Yes, that works in admin, but if you look at your dev link, the error is on the page.
    Right now, I do have the sidebar in my child theme. It the only way I can get it to show on the actual page without altering the thematic files. But if it shows on the page, it doesn't sort in admin. If I use the sidebar.php in my childtheme, it shows on the page correctly, but in admin isn't sorted correctly. I'm dizzy :0

    Posted 2 years ago #
  6. Scott. While seeing what you came up with, I nosed around your actual site. Great stuff, bookmarking. Thank you!
    Arlene

    Posted 2 years ago #
  7. Whoops, the error was only caused because I started working on adding a "Favicon using Gravatar" and turned off the code. I just put it back up and the admin order is in the correct spot. Maybe Kathy will come along and know what the issue is.

    What version of Thematic are you using, and have you tried turning off plugins, or commenting out all other functions as a start?

    Posted 2 years ago #
  8. Just tested in the older 9.7.7 version in the WP Theme repository and it works too. If worse comes to worst, send me your child theme files scott [at] scottnix.com. No clue at this point why you would get different results.

    On the plus side I finally set up one of my test locations to have both versions of Thematic for easy testing. :)

    Posted 2 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.