Genesis – Customize search form

I’m not sure why you’re getting a 500 error. Likely because you’re trying to use a function before it’s been defined. But I think you’re going about the problem the wrong way. Genesis does provide a filter before returning the search form. Why not just add a filter to the genesis_search_form hook? You can add … Read more

add_filter the_content str_replace after shortcode

You can change the priority of actions and filters, it’s the third argument of add_filter (and add_action) and it defaults to 10. So change it to a high number and have your filter fire way after the shortcodes and other stuff are inserted. <?php add_filter(‘the_content’, ‘disable_autocomplete’, 99); function disable_autocomplete( $content ) { return str_replace(‘<form’, ‘<form … Read more

Hide custom image sizes from media library

Using unset and intermediate_image_sizes_advanced will work but only on images uploaded after the function is added. To change it for existing images you need to regenerate them using a plugin ( in essence deleting that image size) or just hide that option from being visible. Tested on 3.5.1 // add custom image size function mytheme_95344() … Read more

Is there a way for a plugin to add an attribute to the tag of a theme?

You can probably use the language_attributes filter (from the language_attributes() function) to add it. It should receive an output like lang=”en” and you can add to it before printing to the <html> tag: add_filter( ‘language_attributes’, function( $attr ) { return “{$attr} manifest=\”manifest.appcache\””; } ); or without a anonymous function add_filter( ‘language_attributes’, ‘wpse140730_add_manifest_to_language_attributes’ ); function wpse140730_add_manifest_to_language_attributes($output) … Read more

username_exists() function can’t be access without logging in

When using Ajax API, and you want to make the ajax callback available for non-logged users, you need to add 2 actions, “wp_ajax_{$action}” and “wp_ajax_nopriv_{$action}”. Using only the first action, the callback will be called only for logged users, using only the second it will be called only for non-logged visitors. Try this: function check_username() … Read more

Getting paginate_links() ‘end_size’ to display none

Here’s one suggestion: First we need to let paginate_links() return an array instead of a HTML list: ‘type’ => ‘array’, Then we can grab the output with: $paginate_links = paginate_links( $paginationArgs ); The plan is then to filter out the wanted links. Let’s get the current value: $c = $paginationArgs[‘current’]; We construct the search filter … Read more

Is the first item returned by get_posts() always the latest post?

Yes and Maybe Yes: According to https://developer.wordpress.org/reference/functions/get_posts/ the default is ordered by date in a descending order. Maybe: But plugins may change the query through ie hook(s) pre_get_posts. https://developer.wordpress.org/reference/hooks/pre_get_posts/ https://developer.wordpress.org/reference/classes/featured_content/pre_get_posts/

adding a filter to a shortcode?

You can change your code to this: <?php $shortcode = do_shortcode(‘[mingleforum]’); echo apply_filters(‘my_new_filter’,$shortcode); ?> and then you can interact with that filter add_filter(‘my_new_filter’,’my_new_filter_callback’); function my_new_filter_callback($shortcode){ //to stuff here return $shortcode; }