Find variables available at a given hook

In general the best solution would be to refer to the documentation for the hook – or the source for the action call within WordPress core’s codebase if the documentation proves insufficient. You can search the documentation for the relevant action or filter here. Many pages actually include the source of the filter/action call which … Read more

Is This A Correct Example Usage Of current_filter()?

Hi @Raj Sekharan: Looks good to me, but is wanting to know the current usage really your question or do you want to understand where current_filter() gets it’s information from? If the latter, here’s basically what happens in all the different hook processing functions, e.g. do_action(), apply_filters(), do_action_ref_array(), apply_filters_ref_array() (greatly simplified, of course): <?php function … Read more

How to make alert for new version on theme options?

see: http://clark-technet.com/2010/12/wordpress-self-hosted-plugin-update-api Basically the idea is to hook your update checking function to the pre_set_site_transient_update_themes filter. The version array key you return from this function will be compared by WP to the current theme version from style.css…. Use the admin_notices action to make your alert message more noticeable

Have Plugin Handle Specific URLs

There are two different things happening here. I’ll start with your second example, as that’s easier. Most shopping carts, in your example WP-Ecommerce, create placeholder pages with a shortcode for things like the cart page and checkout page. All they’re doing to handle that is creating a shortcode function and inserting it on a page, … Read more

How do I hardcode a WordPress shortcode into my theme?

Check out do_shortcode(): http://codex.wordpress.org/Function_Reference/do_shortcode do_shortcode(‘[shortcode option1=”value1″ option2=”value2″]’); So your example would be: do_shortcode(‘[post_comments]’); What might be easier is to tap into the underlying comment functions: http://codex.wordpress.org/Function_Reference/comments_number <p> This post currently has <?php comments_number( ‘no responses’, ‘one response’, ‘% responses’ ); ?>. </p> You can also use get_comments_number which returns the value rather than printing it … Read more

Store loop into array

Try to replace $id[$counter] = get_the_id(); with array_push( $id, get_the_ID() ); to collect the post id’s into the $id array. Update: If you also use $ids instead of $id: $args = array( ‘post_type’ => ‘product’, ‘post_status’ => ‘publish’, ‘ignore_sticky_posts’ => 1, ‘posts_per_page’ => 5, ‘orderby’ => ‘date’, ‘order’ => ‘desc’); $ids = array(); $products = … Read more