Adding option to Gallery shortcode

This code should work in your functions.php add_shortcode(‘gallery’, ‘custom_gallery_function’); function custom_gallery_function($atts) { $user = wp_get_current_user(); // if current user isn’t admin, add posts to be hidden to exclude if(!in_array(‘administrator’, $user->roles)) $atts[‘exclude’] = $atts[‘exclude’] . ‘,’ . $atts[‘hide’]; // call the wordpress shortcode function return gallery_shortcode($atts); }

Conditional hook based on the core function that is calling it

Much probably, using debug_backtrace in this fashion is wild hackerism… Based on @toscho’s tip, the following achieves the same results: add_filter( ‘get_blogs_of_user’, ‘reorder_users_sites’ ); function reorder_users_sites( $blogs ) { if( !did_action( ‘wp_before_admin_bar_render’ ) ) uasort( $blogs, ‘bf_uasort_by_blogname’ ); else uasort( $blogs, ‘bf_uasort_by_domain’ ); return $blogs; }

Getting term_id for newly created or edited term

Use the action created_term. Its first parameter is the $term_id. It is called in wp_insert_term() in wp-includes/taxonomy.php after a term was successful created: do_action(“created_term”, $term_id, $tt_id, $taxonomy); do_action(“created_$taxonomy”, $term_id, $tt_id); The second parameter is the term_taxonomy_id from the term_taxonomy table, and the last parameter is the taxonomy. So register an action with … add_action( ‘created_term’, … Read more

Creating plugin using simple_html_dom parser?

Maybe I’m missing something, but in your first print_r($articles), the global variable $articles is in the scope of the getArticles() function, so we’re all good there. But, in your second print_r($articles), which is happening after the closing brace of the getArticles() function declaration, $articles has not been globalized. So, it’s just set to the empty … Read more

Adding Second Plugin Author

You can add the author as contributor and all I know, he does not get automatically write access to your svn repository. You can also just mentioning the other author without adding him as contributor. My personal opinion is, if you’re worried that the other author steals your code, then he is the wrong helper.

Edit Yoast SEO breadcrumbs output [closed]

They are all null. You haven’t set any of those variables. Here is your function. function ss_breadcrumb_output() { return apply_filters( ‘ss_breadcrumb_output’, ‘<‘ . $wrapper . $id . $class . ‘ xmlns:v=”http://rdf.data-vocabulary.org/#”>’ . $output . ‘</’ . $wrapper . ‘>’ ); } All of the variables in that function are isolated to that function. Variables set … Read more