Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am using the plugin Connections in my website. Now I created a page exclusively for this, so the directory listing has to be only shown if the page is "Directory" and it has to be shown in center.

Currently the plugin is shown in sidebar. How can I solve this issue?

share|improve this question
    
Do you have a link to the problem page? –  s_ha_dum Apr 10 '13 at 4:42
    
I would need to know more about that plugin to answer this and I do not have time to investigate. –  s_ha_dum Apr 10 '13 at 15:44

1 Answer 1

up vote -2 down vote accepted

I found this function which can help u. The key is to change the handle, in this case is contact-form-7. This code snippet will prevent contact-form-7 script from loading except in contact page.

add_action( 'wp_print_scripts', 'my_deregister_javascript', 100 );
function my_deregister_javascript() {
    if ( !is_page('Contact') ) {
        wp_deregister_script( 'contact-form-7' );
    }
}

To get this handler for each script. To do this, you’ll need to open up the main PHP file for each plugin that’s on your list. I did this for WPNG Calendar by going into the plugins folder in FTP and opening wpng-calendar.php in an editor, then doing a search for wp_enqueue_script, which loads JavaScripts into generated pages in WordPress. The handle is the first element in parentheses in each wp_enqueue_script line.

I got the info from http://www.position-relative.com/2010/wordpress/wordpress-only-load-plugins-on-pages-that-need-them/

To show in the center just edit your CSS, if u have some width defined to your directory listing adding margin:0 auto 0 auto; should be enough

share|improve this answer
2  
This is marked as the accepted solution but how does deregistering a script cause a "plugin ... shown in sidebar" to 'to be only shown if the page is "Directory"' and "to be shown in center"? –  s_ha_dum Apr 9 '13 at 14:33
    
@s_ha_dum: Yes after I tried it, I am still unable to fix my issue. I thought I am doing some mistake on my end. Do you have any solution for this? –  Tom Apr 10 '13 at 2:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.