2

I work as a Webmaster at a Canadian company named Atrium Innovations. Our corporate website currently runs on WordPress. Several plugins are installed on our WordPress version, and one of them as been built internally by a previous webmaster.

This plugin shows documents using a sidebar layout and is located in the Secondary Aside panel (Widgets).

It's been working very well until it started constantly switching into the Inactive Widgets zone, which seems to remove it from the Secondary Aside panel and makes it disappear online. I don't know why it started doing that. I might have changed something in the functions.php file, but I'm not sure I did change the code (just opened the file I think). Well, what's for sure is that if I switch tabs into the Admin panel from Appearance to any other tab and the come back to the Appearance one, the widget would inevitably reappear in the Inactive section that disappeared from the Secondary Aside panel.

What could be the issue causing that? Do I have to modify the plugin code or any code within the functions.php file to correct that?

1
  • 1
    you can do a lot with functions.php and/or a custom build plugin so that question is very difficult to even guess how to answer if you don't post your code
    – jtheman
    Commented Nov 1, 2012 at 14:29

1 Answer 1

1

Well, ok thanks for the feedback. I guess I can't attach any file here and copy/pasting the whole PHP pluggin's code would be a little invasive maybe. What do you suggest? Is there any good practice for posting code here?

The related widget appears on the left column on that page:

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

You'll see there are a couple of file, starting with Annual General Meeting.

I really need to get this to work, so I'm posting the pluggin's code anyway:

http://jfverville.com * Description: Affiche les liens rapides de Investors * Version: 0.1 * Author: JF Verville * Author URI: http://jfverville.com / // Principal Class class Investor_Snapshot extends WP_Widget { //Widget setup. function Investor_Snapshot() { / Widget settings. */ $widget_ops = array( 'classname' => 'investor-snapshot', 'description' => __('Widget affichant les liens rapides section investisseurs', '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;
}

} //Add function to widgets_init that'll load our widget. add_action( 'widgets_init', 'load_Investor_Snapshot' );

//Register our widget. function load_Investor_Snapshot() { register_widget( 'Investor_Snapshot' ); }

Thanks again

You must log in to answer this question.