upload featured image from front end using wordpress add media button
add below code after echo $attach_id…. set_post_thumbnail( $post_id , $attach_id);
add below code after echo $attach_id…. set_post_thumbnail( $post_id , $attach_id);
You are almost certainly going to need to write a set of scripts to accomplish what you are looking to do. The first step would be get all of them imported as attachments. You’ve got a great set of specs for those scripts so the next step is to write each of them (actually, each … Read more
Invalid argument supplied for foreach means that the X in foreach X as … is not an array. You can prevent this error by type casting; add (array) before the argument in the foreach statement. This will turn your variable into an array, essentially. In your code, the change would be… foreach ( (array) $attach_meta[‘sizes’] … Read more
I know it’s one year old but just in case someone else is also searching: You could upload the main files (not all 3 sizes, just the original images) via FTP to another directory on your server and then use the Add-From-Server Plugin.
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
Take a look into /wp-admin/custom-header.php. You may extend the class Custom_Image_Header and adjust it to your needs.
The easiest php solution would be to make a download script. It checks if the user has the right permissions and serves the file to the webclient. Or my preference setup a folder outside your web root and put the files there. Set the file permissions with no anonymous access and let the webserver read … Read more
To add to what @brasofilo answered 3 years ago, this is what is necessary in the current menu system (WP v4.5.1). add_action( ‘admin_head-edit-tags.php’, ‘modify_menu_highlight_wpse_43839’ ); function modify_menu_highlight_wpse_43839() { if( ‘post_tag’ == $_GET[‘taxonomy’] ) { ?> <script type=”text/javascript”> jQuery(document).ready( function($) { $(“#menu-posts, #menu-posts a”) .removeClass(‘wp-has-current-submenu’) .removeClass(‘wp-menu-open’) .addClass(‘wp-not-current-submenu’); $(“#menu-media, #menu-media > a”) .addClass(‘wp-has-current-submenu’); }); </script> <?php } … Read more
The current screen doesn’t appear to be set when that filter is run, so you cannot use that. Also, the $post actually refers to the attachment, not the post – so we can’t get the post typ fro that either…. So looking at the source code: http://core.trac.wordpress.org/browser/tags/3.3.2/wp-admin/includes/media.php The filter you are using is called by … Read more
The limiting factor appears to be in your .htaccess file: php_value post_max_size 1M The post_max_size needs to be at least equal to the upload_max_filesize, so increase that to 100M. The settings in .htaccess should override the settings in php.ini. Edit: If that doesn’t work, and since you have full root privileges, you can modify the … Read more