Tag Info

New answers tagged

1

I would recommend using this plugin instead: https://wordpress.org/plugins/cpt-bootstrap-carousel/ It works well with the built-in Twitter Boostrap 3 in Roots.oi theme (Responsive) and it comes along with a CPT named carousel. Looking in your code: The get_post_gallery_images() function only returns the url and it doesn't contain any Gallery Image Title ...


2

Turns out .htaccess was missing the following lines # uploaded files RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]


-1

There was problem in my .htaccess file, that was preventing direct image urls


0

Since you don't present the code you are currently using, it's difficult to answer. But you could consider adding float: right; to the CSS of the featured image?


2

You could easily do this by hooking into the save_post action and updating the featured image custom field. In your functions.php file, add the following code: function interit_featured_image( $post_id ) { // Get Parent ID $parent_id = wp_get_post_parent_id( $post_id ); // Only proceed if this page has a parent if ($parent_id != 0) : ...


1

I decided to approach it differently. Instead of hooking into 'wp_handle_upload_prefilter' and tampering with the $file variable I decided to do the resize after the file is uploaded and after I get the attachment id like this: public function resize_attachment($attachment_id, $width, $height) { // Get file path $file = ...


0

This seems overly complex, when Wordpress offers a native function to add image sizes. I know that this adds another file with a different name, but how does it NOT meet your needs? Function: add_image_size


0

You need to hook into the image_send_to_editor filter. This allows you to modify the markup used when inserting an image into the content editor. Something like this should work: add_filter('image_send_to_editor', 'my_add_rel_nofollow', 10, 8); function my_add_rel_nofollow($html, $id, $caption, $title, $align, $url, $size, $alt = '' ){ // check if ...


0

I use define('UPLOADS', 'wp-content/folder'); in my config.php file right under require_once(ABSPATH.’wp-settings.php’); You can try to change the folder to something like %postname% define('UPLOADS', 'wp-content/%postname%');


0

You can add custom class to post thumbnails. the_post_thumbnail accepts array of attribute $attr where you can specify image class. So your code will be. <div class="home-featured-img"> <?php if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it. the_post_thumbnail( 'full', array( 'class' ...


1

The second argument of the_post_thumbnail is $attr, which you can add classes to. One note is that you will be overriding the default classes, so you will need to add them in as well. The default is attachment-$size, which is why I added attachment-post-thumbnail in my example. the_post_thumbnail( 'post-thumbnail', array( 'class' => ...


1

I found the same issue here and the solution from there works. The solution is as simple as pasting this: $content_width = 2000;// Value higher than your new 'large' width in functions.php Explanation copied from there(user Chip Bennett): I believe your issue is that the value set for the global $content_width variable (which is 640px in ...


-2

<?php $productdetail = get_post_meta( $post->ID, 'portfolioslider', true ); //echo '<pre>'; //var_dump($productdetail); $p=0; foreach( $productdetail as $portfolio){ $src = wp_get_attachment_image_src( $productdetail[$p]['slide'], 'full' ); ?> <li> ...


2

I'd take a look at how WordPress has constructed their attachment tests. You'll find that in tests/phpunit/tests/post/attachments.php they use this method: function _make_attachment( $upload, $parent_post_id = 0 ) { $type = ''; if ( !empty($upload['type']) ) { $type = $upload['type']; } else { $mime = wp_check_filetype( ...


2

There are four valid sizes built in to the WordPress core. the_post_thumbnail('thumbnail'); // Thumbnail (default 150px x 150px max) the_post_thumbnail('medium'); // Medium resolution (default 300px x 300px max) the_post_thumbnail('large'); // Large resolution (default 640px x 640px max) the_post_thumbnail('full'); // ...


1

You should add !important to your styles in order to override it. Better way to do this is to copy the .img-responsive styles from the Bootstrap CSS file and apply these styles to your desired HTML element instead of adding a class using PHP. img.attachment-large { display: block; max-width: 100%; height: auto; } Or target the element by the ...


2

What you are asking for is called "upscaling images". Wordpress does not do that by default (with reasons). 2 solutions: no physical upscaling: display your images via CSS (and not as IMG html tags), using background-size: cover; a plugin that upscale images. Here is one (untested).


1

Let's go and see. If I take arbitrary attachment in my dev install and dump its post object and custom fields I get the following: object WP_Post (24) { public ID -> integer 1687 public post_author -> string (1) "1" public post_date -> string (19) "2013-09-18 14:37:07" public post_date_gmt -> string (19) "2013-09-18 21:37:07" ...


0

Before questioning please search for the available resources. I've found two available plugins: Categories Images - WP Plugins WPCustom Category Image - WP Plugins I personally used the first one, and grabbed the necessary code from the plugin to implement my own version, and it worked perfectly.


0

You would need to connect to your webserver via FTP, and navigate to that folder. That folder is not accessible via the WordPress admin utilities.


0

'category_name' will not work. You are making use of a custom taxonomy, not build-in categories. It seems from this that you have a misunderstanding about taxonomies. Please take your time and see this post on this particular subject For custom taxonomies, use a tax_query to retrieve the posts that you need. Here is an example: $query_images_args = array( ...


1

I updated PHP to 5.3.3-38 (el6) and that seemed to fix it for now.


0

Figured it out. //Remove original Gallery function remove_the_first_gallery( $output, $attr ){ $output = '<!-- gallery 1 was here -->'; // Must be non-empty. return $output; } add_filter( 'post_gallery', 'remove_the_first_gallery' ); That removed all galleries on the page. But since my new gallery isn't technically a post_gallery, it was ...


0

Have you tried this plugin from Addthis: https://wordpress.org/plugins/addthis/


1

A quick and easy fix for this is to make use of a plugin called Force Regenerate Thumbnails (to which I don't have any affiliation to) Unlike a plugin like Regenerating Thumbnails, Force Regenerate Thumbnails creates all your new custom sizes and delete all redundant/orphaned sizes. Force Regenerate Thumbnails allows you to delete all old images size ...


1

I think you are looking for wp_get_attachment_url To get the image src, you can use wp_get_attachment_image_src


1

Where are you attempting to get the image? That should be the correct function: global $post; $image = get_the_post_thumbnail( $post->ID ); It will return an array of all the image sizes for that given image. You can then grab the image size out of the array, or better yet pass in a specific image size to the function to return the correct size: ...



Top 50 recent answers are included