New answers tagged

0

I ended up with this <?php //get children of page 241 and display with custom fields $args=array( 'post_parent' => 825, 'post_type' => 'page', ); $my_query = null; $my_query = new ...


0

Haven't tested it, but this should work: // check for file upload size // { if( !current_user_can( 'administrator') ) add_filter( 'wp_handle_upload_prefilter', 'mdu_validate_image_size' ); } add_filter('wp_handle_upload_prefilter','mdu_validate_image_size'); function mdu_validate_image_size( $file ) { if ( mime_content_type($file) == 'application/zip' ...


0

If you wan use image from theme dir, then you should create all sizes image e.g. logo_300x300, logo_fullsize, logo_small,... You can upload image with media_handle_sideload function, more information https://codex.wordpress.org/Function_Reference/media_handle_sideload


0

add_image_size function has nothing to do with the images that are located in theme root directory. When you add add_image_size function , we are saying that : Hey WordPress! Can you please also re-size my uploaded images via WordPress admin to this particular size also hard crop the image if image size is bigger ( since third argument is set to true ). ...


0

Dont mess with all this. Just go to the wordpress dashboard > Media, delete the titles from each picture. Done.


-1

Here yet another approach: Its hooks into the 404 HTTP error handling. That is, when thumbnail is not available, find the original image and create the thumbnail. Note that this does not really solve your problem, as it does not preven thumbnail generation during upload. Note also that this plugin might be used by malicious users to create any number of ...


0

I think the best solution for this is the plugin Real Media Library: http://codecanyon.net/item/wp-real-media-library-media-categories-folders/13155134 It can organize the media library with folders. The words of the product description says all: Turn your WordPress media library to the next level with folders / categories. Get organized with thousands ...


1

That's the same media manager. The first image is what you see if you try to put a gallery into your page or post. The second is what you will see if you add a Featured Image, where the gallery tab would not be relevant.


0

If you want to modify the main <header> output take a look at header.php. This file will be called before the other templates. If you want to modify the template that is used to display your latest blog posts, index.php would be the file of choice. Index.php is also the fallback template for any post object so you might want to let it as it is to ...


0

This probably has to do with the ImageMagick library that WP normally uses to resize images. I'm not sure whether it is possible to modify the standard settings WP applies, but it is possible to define your own. Here is a tutorial for that. You would have to replace the filter in that tutorial with one of your own using ImageMagick's interface. But that's a ...


0

In your functions.php you want to issue a call to set_post_thumbnail_size() https://codex.wordpress.org/Function_Reference/set_post_thumbnail_size As with add_image_size, you provide the target width, height & whether you want the image hard cropped to these dimensions. So, for example, set_post_thumbnail_size(427, 427, true); will crop all your ...


2

If you add this to functions.php, this will update the options as set. function custom_image_size() { // Set default values for the upload media box update_option('image_default_align', 'center' ); update_option('image_default_size', 'large' ); } add_action('after_setup_theme', 'custom_image_size'); You can update the options as you need.


1

Look in your theme structure, if it has single-post.php or single.php you can edit it, it shouldn't change the pages (but keep a backup just in case) If you don't have these, create it alternatively, if you only want it to work for a certain type of post, create a custom post type (you can do it manually or using a plugin such as ...


1

I highly recommend updating all of your URLS. This can be done either with a word press plugin such as Velet Blues Update URLS Or via your SQL database: UPDATE wp_posts set post_content=REPLACE(post_content, 'www.live.com/', 'www.test.com/'); note* images are uploadeded as posts in your database.* ( wp_posts table with a post_type of "attachment". )


1

Its the way the photos are encoded and they sometimes respond differently on different devices/platforms. If the images aren't referenced in your posts, you can open them all in a program such as Adobe Bridge/Lightbox and bulk re-save them all. This should fix the issue, but is a bit more manual.


2

Yes, this is a known problem between ios devices and Wordpress. It's a real issue due to the high numbers of iPhone/ipad users who also use Wordpress, and I'm surprised it hasn't been addressed in the Wordpress core. Looks like it's still being debated/ worked on here. It's a question that's been asked before here. As that answer notes, there are plugins ...


0

Your page is loaded with jQuery errors (not using no-conflict), and additionally your isotope.js doesn't appear to be in no-conflict. This is why you're getting errors like $ is undefined. Once you fix your jQuery by either replacing the $ with jQuery or wrapping your functions in (function($) { $('selector');// Now you can use the $ to do whatever you ...


0

Go to visuals when writing a post or building a page. Then use this: <img src="http://your image .jpg" /> Just copy the complete image address and paste it in between the quotes " ".


1

This is some specific shortcode to some plugin, that if you just want to paste an image in wordpress editor isn't necessary. (Also there is not enough info about what this shortcode is about). So there is simple HTML that will simply display link you want as an image, following: <img src="http://here-goes-some-url-of-your-image" /> Make sure you ...


0

I needed the code in functions.php so that I could re-use it. Here's my solution below: function get_img_alt($attachment) { $post = get_post(); $image_id = get_post_meta( $post->ID, $attachment, true ); $image_alt = get_post_meta($image_id, '_wp_attachment_image_alt', true); print $image_alt; }


0

Whether any of the four (alt, title, description, caption) texts related to an image get shown, depends on the theme. If you instert images manually in a post, it depends on what you do. Technically, images are treated like special posts, with a title (title tag), content (description) and excerpt (caption). You will see lightbox plugins extract this ...


0

This is directly from the Yoast website: The alt and title attributes of an image are commonly referred to as alt tag or alt text and title tag even though they’re not technically tags. The alt text describes what’s on the image and the function of the image on the page. So if you have an image that’s used as a button to buy product X, the alt text would ...


0

Images that are uploaded through WordPress are saved to /wp-content/uploads/ independent of your theme or child theme, and commonly accessed through helper functions (e.g. the_post_thumbnail()) that will output HTML, including the image path(s). Therefore I'm ruling out that this is what you are trying to do. Instead I'm assuming you are trying to load ...


1

Update 1: After dived into core AJAX call, this filter will only happen on post.php page: add_filter('ajax_query_attachments_args', function($query){ if ( isset($_POST['post_id']) && !empty($_POST['post_id']) ) { $query['posts_per_page'] = 10; // output 10 images only. } return $query; }); You can use ...


1

I meant you should use wp_get_attachment_image_src() with your $cat_thumb_id. Try this: $cat_thumb_id = get_woocommerce_term_meta($cat->term_id, 'thumbnail_id', true); $cat_thumb = wp_get_attachment_image_src($cat_thumb_id, 'medium_large'); $cat_thumb_src = $cat_thumb[0] ? esc_url($cat_thumb[0]) : mytheme_catch_that_image(); ?><img ...


0

I found it :D Yeeeeeeeeaaaahhhhhh :)))) This is final code that worked! I explained each level ;) /* for get author ID use these */ $curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author)); $author_id = get_the_author_meta('ID'); /* First condition */ if( get_the_author_meta('management_certi', ...


2

There's no need for the wp-content/themes path - both themes sit in the same directory, so you can just traverse up one and then back down to child theme: background-image: url(../child-theme-name/images/some-image.png); Update: Regarding your answer to "where is the CSS file stored", you inferred that the stylesheet resides in the child theme folder - in ...


2

I can already tell that you're using ACF - if you don't want to change the return settings for the field, you can bypass ACF and just pull the image ID directly from post meta: $image_url = get_field( 'my_field_name' ); $image_id = get_post_meta( $post->ID, 'my_field_name', true ); $image_meta = wp_get_attachment_metadata( $image_id );


0

You can use the_content filter to filter all post content and replace img sources. add_filter( 'the_content', 'show_full_sized_images' ); /** * Replaces all -600x999 images with full image url * @param string $content * @return string */ function show_full_sized_images( $content ) { $pattern = '~(http[^\'"]*)(-600x[0-9]{2,4})(\.jpe?g|png|gif)~i'; ...


0

No need for a routine here - use the WordPress hook system to "attach" a function that will run when a post is published: // https://codex.wordpress.org/Plugin_API/Action_Reference/publish_post function wpse_225371_post_published( $post_id, $post ) { // Do your thang } add_action( 'post_published', 'wpse_225371_post_published', 10, 2 );


0

Try adding this to your functions.php - it will wrap the image in the div you want. function filter_image_send_to_editor($html, $id, $caption, $title, $align, $url, $size, $alt) { return '<div class="post-page-image" id="image-'.$id.'">'.$html.'</div>'; } add_filter('image_send_to_editor', 'filter_image_send_to_editor', 10, 8);


0

I've actually forgotten to create the function for uploading and attaching images. I've found the correct method into another question here Uploading Multiple Attachments From Front-End With A Description.


1

Modified for the latest WordPress version. Full guide available here : https://phpbits.net/wordpress-replace-user-uploaded-large-images-automatically/ /* * Remove Original Uploaded images * retain large size image */ add_filter('wp_generate_attachment_metadata','phpbits_replace_uploaded_image'); function phpbits_replace_uploaded_image($image_data) { // ...


0

Florian's answer is probably your best bet because it gives the author the most control as to how the images are aligned so that would be my first answer. However, if you don't trust your authors to align the images themselves then we'll have to go another route. Unfortunately for the reasons you stated above, it doesn't look like we can use the :nth-child ...


0

Have the writer use the left/right align functionality built into the WordPress text editor. The editor adds alignleft or alignright classes to the aligned images. Way more info can be found in the WordPress codex.


0

Alternative solution here: http://pixert.com/blog/cropping-post-featured-thumbnails-from-top-instead-of-center-in-wordpress-with-native-cropping-tool/ Just add this code to functions.php, then use "Regenerate Thumbnails" plugin (https://wordpress.org/plugins/regenerate-thumbnails/): function px_image_resize_dimensions( $payload, $orig_w, $orig_h, $dest_w, ...



Top 50 recent answers are included