How do I pass custom shortcode-extracted variables (taxonomy) into a query function for WordPress RoyalSlider?

Two words – variable scope. Use a closure instead and pass $rstax through with use: add_filter( ‘new_royalslider_posts_slider_query_args’, function ( $args ) use ( $rstax ) { return array( ‘post_type’ => ‘carousel-slide’, ‘orderby’ => array( ‘menu_order’ => ‘ASC’ ), ‘tax_query’ => array( array( ‘taxonomy’ => ‘carousel-slide-category’, ‘field’ => ‘slug’, ‘terms’ => $rstax, ), ), ) } … Read more

How to load different homepage on Mobile.?

This question is pretty vague but I’ll give it a shot. A few options: 1) Check out WPtouch – http://www.wptouch.com/ – This plugin gives you the ability to override certain aspects of your primary theme with mobile friendly templates instead. 2) This is not ideal but you could use some basic Javascript to check the … Read more

How to track clicks

Unless you have a “religious” objection to share data with google then using GA is just the simplest and best way to go. Storing stats in your DB is a good start if you want to bring your server down when there is slightly high traffic, and in any case you can get all the … Read more

override filter in a plugin

My mistake was that I was trying to remove the plugin’s filter from within my own plugin. In order to modify a plugin’s filter, the remove_filter() function must be in the child theme’s functions.php file.

Add back to post link on blank comment post error page

I think ‘pre_comment_on_post’ is a better hook to use, although you’ll have to reproduce some logic from “wp-comments-post.php” to use it, eg: add_action( ‘pre_comment_on_post’, function ( $comment_post_ID ) { $go_back = sprintf( __( ‘<br><a href=”https://wordpress.stackexchange.com/questions/207612/javascript:history.go(-1)”>Back to “%s” Article</a>’ ), get_the_title( $comment_post_ID ) ); // Part-copied from “wp-comments-post.php”, with $go_back tagged onto error strings. $comment_author = … Read more

Issues with a WP plugin menu system

This function is still open! Add “}” at the end. function register_submenu_page() { add_submenu_page( ‘broughton-admin-page’, ‘Upload XML’, ‘Upload XML’, ‘manage_options’, ‘upload-xml-page’, ‘upload_xml_page’ ); add_submenu_page( ‘broughton-admin-page’, ‘Archive XML’, ‘Archive XML’, ‘manage_options’, ‘archive-xml-page’, ‘archive_xml_page’ ); }