WordPress 小工具不斷切換

WordPress 小工具不斷切換

我在一家名為 Atrium Innovations 的加拿大公司擔任網站管理員。我們的公司網站目前在 WordPress 上運行。我們的 WordPress 版本上安裝了幾個插件,其中一個是由以前的網站管理員內部建立的。

該插件使用側邊欄佈局顯示文檔,位於輔助側邊面板(小部件)中。

它一直工作得很好,直到它開始不斷切換到非活動小部件區域,這似乎將其從輔助旁邊面板中刪除並使其在線消失。我不知道為什麼它開始這樣做。我可能更改了functions.php 檔案中的某些內容,但我不確定是否更改了程式碼(我認為只是打開了文件)。好吧,可以肯定的是,如果我將選項卡從“外觀”切換到任何其他選項卡,然後返回“外觀”選項卡,則該小部件將不可避免地重新出現在從“輔助旁邊”面板中消失的「非活動」部分。

可能是什麼問題導致的?我是否必須修改插件程式碼或functions.php 檔案中的任何程式碼才能修正該問題?

答案1

嗯,好的,謝謝您的回饋。我想我無法在此處附加任何文件,並且複製/貼上整個 PHP 插件的程式碼可能會有點侵入性。你有什麼建議?在這裡發布程式碼有什麼好的做法嗎?

相關的小工具出現在該頁面的左欄:

http://atrium-innovations.com/en/investors/financial-documents/

你會看到有幾個文件,從年度股東大會

我真的需要讓它工作,所以我無論如何都會發布插件的程式碼:

http://jfverville.com * 描述:Affiche les liens rapides de Investors * 版本:0.1 * 作者:JF Verville * 作者 URI:http://jfverville.com // 主要類別 class Investor_Snapshot extends WP_Widget { //Widget 設定。函數 Investor_Snapshot() { /小部件設定。 */ $widget_ops = array( 'classname' => 'investor-snapshot', 'description' => __('Widget affichant les liens rapides sectioninvestisseurs', 'investor-snapshot') );

    /* Widget control settings. */
    $control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'investor-snapshot' );

    /* Create the widget. */
    $this->WP_Widget( 'investor-snapshot', __('Apercu investisseurs', 'investor-snapshot'), $widget_ops, $control_ops );
}   
/**
 * Displays the widget settings controls on the widget panel.
 * Make use of the get_field_id() and get_field_name() function
 */
function form( $instance ) {
    /* Set up some default widget settings: ('Label par defaut', 'Val. par defaut) */
    $defaults = array('title' => __('Titre', 'titre'));
    $instance = wp_parse_args( (array) $instance, $defaults ); ?>
    <!-- Widget Title: Text Input -->
    <?php if ( ICL_LANGUAGE_CODE == "fr"): ?>
<p>&nbsp;</p>     <p>&nbsp;</p>   <p>&nbsp;</p>   <p>&nbsp;</p>      
     <h3>DOCUMENTS</h3>            
        <?php else: ?>
       <h3>DOCUMENTS</h3>
        <?php endif; ?>
<?php
}
/**
 * Update the widget settings.
 */
function update( $new_instance, $old_instance ) {
    $instance = $old_instance;

    /* Strip tags to remove HTML (important for text inputs). */
    $instance['title'] = strip_tags( $new_instance['title'] );
    return $instance;
}
/**
 * How to display the widget on the screen.
 */
function widget( $args, $instance ) {
    extract( $args );       
    // Use wp_list_pages to display parent and all child pages all generations (a tree with parent)
    $ancestors=get_post_ancestors(get_the_id());
    $parent = ($ancestors[sizeof($ancestors)-1] == "") ? get_the_id() : $ancestors[sizeof($ancestors)-1];
    $type_page = get_post_type();
    /* Our variables from the widget settings. */
    $title = apply_filters('widget_title', $instance['title'] );
    /* Before widget (defined by themes). */
    echo $before_widget;
    /* Display the widget title if one was input (before and after defined by themes). */
    if ( $title )
        echo $before_title . $title . $after_title;
    /* Start of the widget's core */
    if(ICL_LANGUAGE_CODE == "fr"){
    ?>
    <ul>
    <li class="lien_pdf"><a href="<?php echo get_stylesheet_directory_uri(); ?>/uploads/documents/presentations-et-evenements/AGM-2012-ATRIUM-FR.pdf" target="_blank">Assemblée annuelle des actionnaires</a></li>
    <li class="lien_pdf"><a href="<?php echo get_stylesheet_directory_uri(); ?>/uploads/documents/presentations-et-evenements/20120810_analyst_presentation_q2_2012.pdf" target="_blank">Présentation trimestrielle (anglais seulement)</a></li>
    <li class="lien_pdf"><a href="<?php echo get_stylesheet_directory_uri(); ?>/uploads/documents/presentations-et-evenements/ATR_FS12_Q2_fr_v3FINAL.pdf" target="_blank">Fiche aux investisseurs</a></li>
    <li class="lien_ext"><a href="http://www.atrium-innovations.com/brochure_fr/" target="_blank">Brochure corporative</a></li>
    </ul>
    <?php
    } else {
    ?>
    <ul>
    <li class="lien_pdf"><a href="<?php echo get_stylesheet_directory_uri(); ?>/uploads/documents/presentation-and-events/AGM-2012-ATRIUM-EN.pdf" target="_blank">Annual General Meeting</a></li>
     <li class="lien_pdf"><a href="<?php echo get_stylesheet_directory_uri(); ?>/uploads/documents/presentation-and-events/20120810_analyst_presentation_q2_2012.pdf" target="_blank">Quarterly Presentation</a></li>
    <li class="lien_pdf"><a href="<?php echo get_stylesheet_directory_uri(); ?>/uploads/documents/presentation-and-events/ATR_FS12_Q2_en_v3FINAL.pdf" target="_blank">Investor Fact Sheet</a></li>
    <li class="lien_pdf"><a href="<?php echo get_stylesheet_directory_uri(); ?>/uploads/documents/presentation-and-events/ATB-Investor-Presentation-August2012-Final.pdf" target="_blank">Investor Presentation</a></li>
    <li class="lien_ext"><a href="http://www.atrium-innovations.com/brochure_en/" target="_blank">Corporate Brochure</a></li>
    </ul>       
    <?php
    }
    /* End of the widget's core */
    /* After widget (defined by themes). */
    echo $after_widget;
}

} //在 widgets_init 中加入函數來載入我們的小部件。 add_action( 'widgets_init', 'load_Investor_Snapshot' );

//註冊我們的小工具。函式 load_Investor_Snapshot() { register_widget( 'Investor_Snapshot' ); }

再次感謝

相關內容