How to programmatically detect how many posts are displayed per page?
The option is appropriately named posts_per_page. FYI you can see the value of options in your database by visiting wp-admin/options.php.
The option is appropriately named posts_per_page. FYI you can see the value of options in your database by visiting wp-admin/options.php.
http://www.advancedcustomfields.com/ can do front-end forms: http://www.advancedcustomfields.com/docs/tutorials/creating-a-front-end-form/ as well as http://www.gravityforms.com/ which is a commercial plugin.
function test(){ wp_enqueue_script(‘myscript’, plugin_dir_url(__FILE__). ‘js/test.js’,array(‘jquery’)); } add_action(‘admin_print_scripts’,’test’); add_action(‘wp_head’,’test’);
Solution The plugin used only a wordpress function called wp_kses_stripslashes, which only works on double quotes apparently. I simply further processed the passed data through stripslashes and voila.
Since you are using OOP, you probably want to architecture your plugin more efficiently. This is fine, but you’ll be the one to structure your classes and build them. So what if you put it in the __construct() function? That’s fine, as long as you initiate a new instance of the class. Putting it in … Read more
You can try adding a query var using the ‘query_vars’ filter like so: add_filter(‘query_vars’, ‘my_plugin_query_vars’); function my_plugin_query_vars($vars) { $vars[] = ‘login’; return $vars; } That may populate $wp_query->query_vars, if not I have successfully used the get_query_var function in one of my projects, try something like: function my_plugin_display() { if(get_query_var(‘login’)) { include( ABSPATH . ‘/wp-login.php’ ); … Read more
It took me a while but I figured it out, I just placed this in mu functions.php file: function remove_se_filters($query) { if($query->is_feed && $query->is_category){ global $wp_filter; foreach($wp_filter[‘pre_get_posts’][999] as $key=>$filter){ if(strpos($key, ‘se_filters’) !== false){ unset($wp_filter[‘pre_get_posts’][999][$key]); } } } return $query; } add_filter(‘pre_get_posts’,’remove_se_filters’); I found that I couldn’t use the remove filter function because I did not … Read more
the_field() takes an optional second parameter of $post_id. If you know the post you want, presumably you can use that to grab the data you need.
You are most likely not assigning the right page template. Make sure your template name is the same case as the file in your theme directory. Also make sure the file name you provide as the template actually exists in the theme directory otherwise it will be marked as the Default page template.
query_posts() overwrites the original query, and the pagination gets the original before the query_posts() call and the changed after it. Solution: Don’t use query_posts(), filter pre_get_posts instead. We have tons of examples for that on our site. 🙂 Here is some pseudo code (meaning: not tested). add_filter( ‘pre_get_posts’, ‘wpse_58843_list_cat_16’ ); function wpse_58843_list_cat_16( $query ) { … Read more