Role based permission edit for plugins

I think the plugin include the possibility with one check for rights, for a capability. You see in the source of the plugin, that he include the menu items, if the user have the capability edit_theme_options. That makes not so easy for you to change this in different roles. You can create custom roles, like … Read more

Contact Form 7: Load scripts and styles only when there is shortcode? [closed]

This isn’t based on shortcode detection, but you could try // Add the Contact Form 7 scripts only on the contact page function deregister_cf7_js() { if ( !is_page(‘contact’)) { wp_deregister_script( ‘contact-form-7’); } } add_action( ‘wp_print_scripts’, ‘deregister_cf7_js’ ); function deregister_ct7_styles() { wp_deregister_style( ‘contact-form-7’); } add_action( ‘wp_print_styles’, ‘deregister_ct7_styles’); from http://wptheming.com/2009/12/optimize-plug-in-script-wordpress/ I think you could change the wp_print_styles … Read more

How can i list random author?

The Codex lists rand as the orderby string, not RAND. I suspect that either works but I haven’t checked. But that isn’t how I’d do this. I’d lean toward something like… $current_category_ID = getCurrentCatID(); $current_cat_id = $current_category_ID; $author_array = array(); $args = array( ‘numberposts’ => -1, ‘cat’ => $current_cat_id ); $cat_posts = get_posts($args); foreach ($cat_posts … Read more

How can i listing current category and Featured Category post list?

I think you’re asking about your custom secondary loop affecting your main loop, correct? query_posts() alters the main loop. A quick fix would be to call wp_reset_query() after your custom loop to reset the query data: <?php wp_reset_query(); ?> However, it’s more efficient and friendlier to use WP_Query() instead of query_posts() (especially if you’re making … Read more

Accessing widget information

It seems that the index value goes incrementing and we add/remove instances of the widget. To make sure the correct data is grabbed, I can only think of checking inside the widget data itself through some control variable, something like: Array ( [2] => Array ( Accessing widget information => asian kung-fu generation Accessing widget … Read more

Plugin is creating posts twice

The code does not adds posts twice – checked in my local installation. You have got errors in it: $my_post = array( ‘post_title’ => $title, ‘post_date’ => $insDate, ‘post_content’ => ‘$url’, ‘post_status’ => ‘public’, ‘post_type’ => ‘post’, ); Should be $my_post = array( ‘post_title’ => $title, ‘post_date’ => $insDate, ‘post_content’ => $url, ‘post_status’ => ‘publish’, … Read more