Override plugin functions in functions.php

It is possible to filter the get_bloginfo(), but you’ll have to find a way to fine tune the conditional, because the override is global… add_filter( ‘pre_option_blogname’, ‘wpse_58030_override_blogname’ ); function wpse_58030_override_blogname( $bool ) { // If not page with ID == 28, do nothing if( !is_page( 28 ) ) return false; // Change the ‘blogname’ return … Read more

How do I list the_tags() into HTML data-attribute

Use json_encode(): <li class=”griditemleft” data-tags=”<?php $posttags = get_the_tags(); $data = array(); foreach($posttags as $tag) { $data[] = $tag->name; } echo json_encode( $data ); Later, in your JavaScript, iterate over the li items and for each item use: // get an array of tag names with jQuery’s parseJSON() var itemtags = $.parseJSON( item.data(‘tags’) ); See jQuery … Read more

Using wp_get_image_editor in a standalone script

Turns out I’m just silly. WP_Error was the undefined method, not resize. I was sending a bad image location through the resize function. How silly of me! It was working all along. I’ve included this on top $parse_uri = explode( ‘wp-content’, $_SERVER[‘SCRIPT_FILENAME’] ); require_once( $parse_uri[0] . ‘wp-load.php’ ); and this is my image resize function … Read more

Display All Non-Used Plugins

I think you can use this plugin: http://wordpress.org/extend/plugins/wpmu-plugin-stats/screenshots/ Provides info to site admins as to which plugins are activated sitewide, and which blogs plugins are activated on. This plugin is using get_plugins() http://codex.wordpress.org/Function_Reference/get_plugins and fetches get_option(‘active_plugins’) for each blog to compare. It uses switch_to_blog() on each blog so it might be slower on large multisites, … Read more

What is user_trailingslashit() for?

The trailingslashit() function adds a / to the end of a URL if it lacks one. user_trailingslashit() uses the permalink template as set under Settings > Permalinks to decide whether to add or remove the trailing slash from the end of the URL For example, if you had the permalink format set to /%year%/%monthnum%/%day%/%postname%/ (note … Read more

changing function wp_register

Use the following filter named register: add_filter( ‘register’, ‘wpse_96892_register_link’ ); function wpse_96892_register_link( $link ) { if ( is_user_logged_in() ) return $link; return str_replace( // search array ( site_url(‘wp-login.php?action=register’, ‘login’), __(‘Register’) ), // replacements array ( site_url(‘/profile’), __(‘Profile Page’) ), $link ); }

Trouble using antispambot()

I think the problem is echo vs return, i.e. that you are using the_field instead of get_field. What you’re trying to do is similar to this: antispambot( echo( ‘[email protected]’ ) ) but echo returns nothing. Please try: <?php $email = antispambot( get_field( ‘queries_e-mail’ ) ); ?> <p> <a href=”https://wordpress.stackexchange.com/questions/124180/mailto:<?php echo $email; ?>”> <?php echo $email; … Read more