WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Widget Sidebar arrangement stuck (6 posts)

  1. JSDavis82
    Member
    Posted 7 years ago #

    Hey everyone, I just imported my blogger.com blog to wordpress, and despite the sidebar.php and functions.php looking good, I cannot drag and drop my widgets in the sidebar arrangement screen in the presentation menu.

    Here's what the sidebar.php looks like:

    <div id="sidebar">
    <?php if ( !function_exists('dynamic_sidebar')
    || !dynamic_sidebar() ) : ?>
    <h4>Categories</h4>
    <div class="navigate">
    <ul>
    <?php wp_list_cats('sort_column=name&&hierarchical=1'); ?>
    </ul>
    </div>
    <h4>Archives</h4>
    <div class="navigate">
    <ul>
    <?php wp_get_archives('type=monthly'); ?>
    </ul>
    </div>
    <h4>Blogroll</h4>
    <div class="navigate">
    <ul>
    <?php get_linksbyname('Blogroll', '<li>', '</li>', '', FALSE,
    'rand', FALSE, FALSE, 10); ?>
    </ul>
    </div>
    <?php endif; ?>
    </div>

    here's the functions.php:

    <?php
    // Widgets
    if ( function_exists('register_sidebar') )
    register_sidebar(array(
    'before_widget' => '',
    'after_widget' => '</div>',
    'before_title' => '<h4>',
    'after_title' => '</h4><div class="navigate">',
    ));
    function widget_mytheme_search() {
    ?>
    <h4>Search</h4>
    <div class="navigate">
    <form method="get" id="searchform" action="<?php bloginfo('home'); ?>/">
    <input type="text" value="<?php echo wp_specialchars($s, 1); ?>" name="s" />
    </form>
    </div>
    <?php
    }
    if ( function_exists('register_sidebar_widget') )
    register_sidebar_widget(__('Search'), 'widget_mytheme_search');
    function widget_mytheme_links() {
    ?>
    <h4>Linkage</h4>
    <div class="navigate">
    <ul>
    <?php get_linksbyname('', '<li>', '</li>', '', FALSE, 'rand', FALSE, FALSE, -1); ?>
    </ul>
    </div>
    <?php
    }
    if ( function_exists('register_sidebar_widget') )
    register_sidebar_widget(__('Links'), 'widget_mytheme_links');
    function widget_mytheme_pages($args) {
    extract($args);
    $options = get_option('widget_pages');
    $title = empty($options['title']) ? __('Pages') : $options['title'];
    ?>
    <h4><?php echo "$title" ?></h4>
    <div class="navigate">
    <ul>
    <?php wp_list_pages('sort_column=menu_order&title_li='); ?>
    </ul>
    </div>
    <?php
    }
    if ( function_exists('register_sidebar_widget') )
    register_sidebar_widget(__('Pages'), 'widget_mytheme_pages');
    function widget_mytheme_recent_comments() {
    } if ( function_exists('register_sidebar_widget') )
    register_sidebar_widget(__('Recent Comments'), 'widget_mytheme_recent_comments');
    // Function: Get Recent Comments
    function get_tenrecentcomments($mode = '', $limit = 10) {
    global $wpdb, $post;
    $where = '';
    if($mode == 'post') {
    $where = 'post_status = 'publish'';
    } elseif($mode == 'page') {
    $where = 'post_status = 'static'';
    } else {
    $where = '(post_status = 'publish' OR post_status = 'static')';
    }
    $tenrecentcomments = $wpdb->get_results("SELECT $wpdb->posts.ID, post_title, post_name, post_status, comment_author, post_date, comment_date FROM $wpdb->posts INNER JOIN $wpdb->comments ON $wpdb->posts.ID = $wpdb->comments.comment_post_ID WHERE comment_approved = '1' AND post_date < '".current_time('mysql')."' AND $where AND post_password = '' ORDER BY comment_date DESC LIMIT $limit");
    if($tenrecentcomments) {
    foreach ($tenrecentcomments as $post) {
    $post_title = htmlspecialchars(stripslashes($post->post_title));
    $comment_author = htmlspecialchars(stripslashes($post->comment_author));
    $comment_date = mysql2date('m.d', $post->comment_date);
    echo "<li><span class=\"intr\">$comment_date</span><a href=\"".get_permalink()."\">$comment_author</a></li>n";
    }
    } else {
    echo '<li>'.__('N/A').'</li>';
    }
    }
    //Original Link Drop Down Script by Owen of RedAlt
    define('LINK_USE_UL', true);
    function link_dropdown_page_callback($matches)
    {
    global $wpdb;
    $output = '';

    $linkcats = $wpdb->get_results("SELECT DISTINCT cat_id, cat_name FROM {$wpdb->linkcategories}");
    $output .= '<div id="linkpage"><form id="linkcatselect" method="post">';
    $output .= '<div align="right" style="margin: 0 0 15px 0"><select name="linkcat">';
    $output .= '<option> </option>';
    $output .= '<option selected="selected" value="-1"> &nbsp; All Categories</option>';
    $output .= '<option> </option>';
    foreach($linkcats as $cat)
    {
    $output .= '<option value="' . $cat->cat_id . '"';
    if($cat->cat_id == $_REQUEST['linkcat']) $output .= ' selected="selected"';
    $output .= '>&nbsp; &nbsp; &nbsp; » ' . $cat->cat_name . '</option>';
    }
    $output .= '<option> </option>';
    $output .= '</select> <input type="submit" id="linkcatsubmit" value="Change" /></div></form>';
    if(!isset($_REQUEST['linkcat'])) $_REQUEST['linkcat'] = -1;
    $ret = get_links($_REQUEST['linkcat'], '<li>', '</p></li>', '<p class="post-info">', true, 'name', true, false, -1, 1, false);
    if(LINK_USE_UL)
    {
    $output .= '<ul>' . $ret . '</ul></div>';
    }
    else
    {
    $repl = array('#<li>#'=>'<dt>','#</a>#'=>'</a></dt><dd>','#</li>#'=>'</dd>');
    $output .= '<dl id="linklist">' . preg_replace(array_keys($repl), array_values($repl), $ret) . '</dl>';
    }
    return $output;
    }
    function link_dropdown_page($content)
    {
    $content = preg_replace_callback('|<!--linksdropdown-->|i', 'link_dropdown_page_callback', $content);
    return $content;
    }
    add_filter('the_content', 'link_dropdown_page');
    ?>

    thanks so much for the future help everyone.

  2. JSDavis82
    Member
    Posted 7 years ago #

    sorry, that code might have needed to go in the paste bin, but I thought it was close. Can anyone help me out please? I'd GREATLY appreciate it...

  3. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    Can you access the widgets screen? If so, then the problem is not in your theme.

    If all you can't do is actually drag and drop the widgets, then you have one of two problems. Either:
    a) The scriptaculous folder is in the wrong place, or
    b) Your ad blocker or browser is blocking the javascript files.

    For case A, I suggest downloading the latest version of the widgets plugin from automattic.com. It's been changed a few times in this respect, and had issues at first. The latest version will work with the scriptaculous folder inside the /wp-content/plugins/widgets/ folder. Previous versions said they would work this way, but they would actually not. All versions will also work if you move the scriptaculous folder into /wp-includes/js/.

    For case B, disable any ad blocking software. If you have NoScript installed, disable that. Then try reloading the widgets page. If these fix the problem, then you'll need to add your own site to a whitelist or something to allow the scripts to bypass your filters.

  4. DaBayer
    Member
    Posted 7 years ago #

    Thank you for posting suggested corrections for the two problems stated for the drag-and-drop error.

    The latest version of the widgets plugin from Automattic does not include a scriptaculous folder.

    Since I could not drag-and-drop widgets from the "Available Widgets" tray, I downloaded the previous version of the plugin and extracted its scriptaculous folder to first /wp-content/plugins/widgets/, then /wp-includes/js/. I tested each time by first reloading the page, then logging out and logging back in.

    I still cannot drag-and-drop widgets into the sidebar.

    IE displays the following error on the widgets/widgets.php page:

    Line: 291
    Char: 4
    Error: Object doesn't support this property or method
    Code: 0
    URL: http://. . ./wp-admin/themes.php?
    page=widgets/widgets.php

  5. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    The latest version of the widgets plugin from Automattic does not include a scriptaculous folder.

    Correct, my previous post was 3 months ago, after all. Things change.

    Since I could not drag-and-drop widgets from the "Available Widgets" tray, I downloaded the previous version of the plugin and extracted its scriptaculous folder to first /wp-content/plugins/widgets/, then /wp-includes/js/

    And in so doing, you not only broke the widgets, but the rest of the blog as well.

    To fix it:
    1. Remove the widgets directory.
    2. Remove the wp-includes/js/scriptaculous directory.
    3. Replace the wp-includes/js/scriptaculous directory with a fresh and correct copy from the WordPress download ZIP file.
    4. Install the latest version of the widgets plugin *without* the scriptaculous directory.

    WordPress 2.1 and up includes the scriptaculous functions by default. They are not included in the widget plugin because they are no longer necessary to be there.

  6. DaBayer
    Member
    Posted 7 years ago #

    That got it.

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic