How do I use the Simple HTML DOM Parser in plugin when other plugin already uses it?

If you don’t want to mess with plugin load order, you can trigger the require part a bit later, e.g. via the plugins_loaded hook. function csp_require_simplehtml() { if (!function_exists(‘file_get_html’)) { require(CPS_PLUGIN_PATH . ‘/vendor/simple_html_dom.php’); } } add_action(‘plugins_loaded’, ‘csp_require_simplehtml’);

Including a 3rd party library in WordPress which needs to be accessible by wp-config

1st, the key should be generated once, not per request. The tutorial is suggesting you generate it via the library (probably via cli, or one off script you run in the browser) and then simple add: define(‘JOSH_ENCRYPT_KEY’, ‘the-random-key-you-generated-gets-copy-pasted-in-here-manually’); into your wp-config.php file, so you dont need the lib to be in scope at that point. … Read more

Disable edit option in Media library

There’re several filters that you can utilize: Custom column content If you got a custom column that you added with the “-filter, then you can use the manage_{$post->post_type}_posts_custom_column filter to alter the content. If you only want to target non-hierarchial post types then there’s as well the manage_posts_custom_column and for hierarchical ones, there’s manage_pages_custom_column. All … Read more

Way to display media library in frontend

As far I’ve understood with those I’ve written a simple system for you. Please put the below codes in your functions.php– add_action( ‘wp_enqueue_scripts’, ‘the_dramatist_enqueue_scripts’ ); add_filter( ‘ajax_query_attachments_args’, ‘the_dramatist_filter_media’ ); add_shortcode( ‘the_dramatist_front_upload’, ‘the_dramatist_front_upload’ ); /** * Call wp_enqueue_media() to load up all the scripts we need for media uploader */ function the_dramatist_enqueue_scripts() { wp_enqueue_media(); wp_enqueue_script( ‘some-script’, … Read more

Too much recursion error when chosing image from image library for two different meta boxes in one post

I think you’re running into a problem people mentioned in the comments to that story. Someone else posted about it here: http://www.theenglishguy.co.uk/2010/01/24/multiple-media-uploads-in-wordpress-functions-php/ Basically, the JavaScript from that site should be modified to be more like this: jQuery(document).ready(function() { var formlabel = 0; var old_send_to_editor = window.send_to_editor; var old_tb_remove = window.tb_remove; jQuery(‘.upload_image_button’).click(function(){ formlabel = jQuery(this).parent(); tb_show(”, … Read more

Image dimensions same as image size

No, it won’t create a new image that is exactly the same size.. nor should it. All the thumbnail, medium, and large images are resized images, by definition. Since the original image is already 600×600, there’s no point in creating another file at the same size, but with a lower quality (remember that JPEG compression … Read more