« first day (383 days earlier)      last day (4547 days later) » 

12:49 AM
@kaiser thanks! I need to write up a blog post, and get the final version uploaded to the Codex, but the hard part is done. :)
 
@ChipBennett Please don't forget to replace the link to your page below the current template hierarchy img :)
 
@kaiser Oh, I'll leave the final/working version on that static Page. I'm just going to write a blog post to explain all of the features/details of the diagram.
 
 
8 hours later…
8:51 AM
@Brady was that you who needed SMS notifications for something? Amazon announced they now have those in some service
SMS
First 100 Amazon SNS SMS Notifications per month are free
$0.75 per 100 Amazon SNS SMS Notifications thereafter
 
I was talking about SMS but not about needing it
 
ah, ok
 
US only or SMS to world?
I use tm4b for my SMS and if I want to send SMS in the US I use clickatel
 
US only on launch it seems
Q: Does Amazon SNS currently support notification delivery to international phone numbers?
Currently Amazon SNS will only accept US phone numbers as valid subscription end-points.
 
but I havent been doing a lot of long distance relationships for a long time so my sms abroad usage has gone down to zero
 
 
2 hours later…
10:50 AM
anyone got a link to an example on how to add an extra field to the media library
NVM i found one
 
 
1 hour later…
12:10 PM
anyone know why this: set_post_thumbnail_size( 166, 166, true ); in my theme functions file is being ignored?
its being overrriden by wordpress settings in media settings
 
it's different sizes, you sure you are asking for right one?
 
<?php echo wp_get_attachment_image( $image->ID, "thumbnail" ); ?>
so im setting thumbnail size to 166*166 but its using WP default setting size of 150*150
 
should be post-thumbnail
 
umm ok
I thought the post-thumbnail is what thumbnail is
 
confusing as hell, but no :)
 
12:17 PM
so if I dont set post thumbnail size then what size is used?
so If I dont set a size I cannot use post-thumbnail to retrieve size?
im lost....
 
the_post_thumbnail() it should handle that
or maybe not... not a quick question
 
add_image_size('thumbnail', 166, 166, false);
add_image_size('medium', 414, 414, false);
add_image_size('large', 800, 800, false);
^^ medium and large work but it doesnt on thumbnail
 
native sizes are best ignored really
it's up to specific blog to set them...
 
not in this case
 
from the start. what do you want to do and which cases to handle?
 
12:21 PM
I dont want the blog to set native sizes
 
kill them then
 
I want the theme to control the native sizes. end of. I dont want to make 3 aditional sizes when I can use native ones
 
as above, kill them? or need advice on how?
 
So you saying kill them by stopping wordpress making the native sizes?
 
yeah
 
12:23 PM
but If I do that then the insert image into post no longer works
 
hm, really?
 
because thumbnail/medium/large images are no longer there
 
I don't do much (any) inserting, sorry if misleading...
ok, then leave native. don't use them. what are the issues with not using them?
 
arrrgghhhh!!!
ok listen up ;)
add_image_size('medium', 414, 414, false);
add_image_size('large', 800, 800, false);
the above works in overriding the medium and large image sizes
great because my theme can set the sizes and still maintain all the WP functionailty with inserting into post
medium and large still exist on the system and WP knows they are there
but I manually want my theme to set the thumbnail size to
 
bzzzz... as above - messing with native in code is not so good idea
 
12:27 PM
Im not messing with native
the above is in my theme functions file
Im not touching core
 
ok, let's try to make your evil ways work...
 
Im simply telling WP to set the large and medium image sizes to what I want
 
what is your problem with thumbnail size?
 
just as if I went into settings and set them myself
Im after this because its a multisite setup running the same theme 15 times.
Instead of making sure each instance of the multisite is running the correct images sizes its better if my theme sets the sizes for them
 
@kaiser I closed github question after all... sorry but it's clearly not scope as per cleaned up FAQ and I don't want to bend rules
ok, I agreed to doing evil already! what's the problem with thumb?
 
12:29 PM
add_image_size('medium', 414, 414, false);
add_image_size('large', 800, 800, false);
^^ works yes
 
ok
 
add_image_size('thumbnail', 166, 166, true);
^^ doesnt work
 
define doesn't work. what are you trying to do after this that fails?
 
doesnt work as WP is ignoring it and using whats set in settings instead
 
ignoring when? show me the function calls :)
 
12:32 PM
Ive given you all the code I have
I want my theme to set the thumbnail size to 166*166
so I use this:
add_image_size('thumbnail', 166, 166, true);
but then I upload an image and it makes the image to the size of 150*150
not 166*166
add_image_size('medium', 414, 414, false);
add_image_size('large', 800, 800, false);
add_image_size('thumbnail', 166, 166, true);
^^ doesnt
^^ works
cannot get any simpler than that
^^ those are my media settings. But I want WP to ignore them as the sizes as I cannot rely on every instance of WP on the multisite to set these correctly
Im running a multisite because its for a global firm that want different content for each country but the theme is exactly the same
 
I don't know. it should work. what image is generated? physical 150x150? what does meta array has?
 
image size generated is 150*150
a 166*166 is not generated
 
size "thumbnail" ?
 
yes
@Rarst meta array?
umm hang on
 
I've dropped your add_ calls into my test theme and it worked just fine for all sizes
 
12:42 PM
just testing it now after wiping any existing images
ok yes it creates the 166*166 image but when you echo it to the screen it turns it into a 150*150
 
ok, progress
what's the call to echo?
 
<?php echo wp_get_attachment_image( $image->ID, "thumbnail" ); ?>
also in "insert into post" is says the thumbnail is 150*150 despite the thumnail that was generated was 166*166
 
works fine for me
 
not here...
are you uploaded an image when attaching to a page or using the media section?
 
media
 
12:49 PM
can you try when attaching to a page
 
@Brady Have you already dumped the registered image sizes? Maybe some predefined stuff is interfering?
@Rarst It's ok, I edited the Q anyway
 
@kaiser how?
 
var_dump( $GLOBALS['_wp_additional_image_sizes'] );
 
rray(4) {
  ["home_case_study"]=>
  array(3) {
    ["width"]=>
    int(208)
    ["height"]=>
    int(138)
    ["crop"]=>
    bool(true)
  }
  ["thumbnail"]=>
  array(3) {
    ["width"]=>
    int(166)
    ["height"]=>
    int(166)
    ["crop"]=>
    bool(true)
  }
  ["medium"]=>
  array(3) {
    ["width"]=>
    int(414)
    ["height"]=>
    int(414)
    ["crop"]=>
    bool(false)
  }
  ["large"]=>
  array(3) {
    ["width"]=>
    int(800)
    ["height"]=>
    int(800)
    ["crop"]=>
    bool(false)
all correct there so why am I still getting 150*150 image size for thumbnail
 
yeah, physical is changed but upload says 150x and inserts as such in HTML
 
12:54 PM
Wrap it up in a function and add it to wp_footer hook.
 
ok
@kaiser same output
 
Ok... try this filter: apply_filters( 'wp_get_attachment_image_attributes', $attr, $attachment )
 
whats the rest?
 
Just look inside wp_get_attachment_image()
That's exactly where it's failing, right?
 
youve lost me
@Rarst are you further investigating?
 
12:57 PM
yeah
 
no. I just say dump it, exactly where it's failing and inspect the output.
 
can haz snippet pleewwss?
 
?
 
can I have the code to do what your asking me to do
cos Im not 100% sure what your asking me to do
 
function test_brady_snippet( $attr, $attachment ) {
     var_dump( $GLOBALS['_wp_additional_image_sizes' ] );
     return $attr;
}
add_filter( 'wp_get_attachment_image_attributes',  'test_brady_snippet', 20, 2 )
 
1:01 PM
ty
 
mom: last line
 
same output
 
priority + args
ok...
sounds like image_downsize() is failing
Try this filter: apply_filters('image_downsize', false, $id, $size)
Let's see what's inside $size
 
function test_brady_snippet( $id, $size ) {
     var_dump( $size );
    die();
}
add_filter( 'image_downsize',  'test_brady_snippet', 10, 2 );
99
 
You know what: Go into core and do a var_dump of $width, $height inside image_downsize().
/wp-includes/media.php line ~170
if it's not failing there, I don't know where else it could
 
1:07 PM
wp_get_attachment_image_src($attachment_id, $size, $icon);
^^ is returning the wrong size
ok that function uses downsize let me go into that
 
yea, that's what I'm saying
 
array(4) { [0]=> string(57) "http://www.hi-rezz.com/uk/files/2011/09/large-166x166.gif" [1]=> int(150) [2]=> int(150) [3]=> bool(true) }
image_constrain_size_for_editor()
next function to look into?
 
after what if/else exactly? I mean "until where is it ok"?
 
huh?
 
nvm. wrote it before your last 2 lines
check wp_constrain_dimensions() first
 
1:12 PM
its 166*166 before it gets to image_constrain_size_for_editor()
 
then move up to beginning of wp_constrain_dimensions()
just to see if it fails there
 
ok
    var_dump(array($width, $height, $max_width, $max_height));

	return wp_constrain_dimensions( $width, $height, $max_width, $max_height );
$width and $height is set to 166
bu the max values are set to 150
elseif ( $size == 'thumb' || $size == 'thumbnail' ) {
		$max_width = intval(get_option('thumbnail_size_w'));
		$max_height = intval(get_option('thumbnail_size_h'));
^^ see that
its getting 150 from settings
 
trac
+ a good idea to fix that :)
 
how would you fix though?
 
nvm. just joking
 
1:16 PM
what I dont understand though is this
elseif ( $size == 'medium' ) {
		$max_width = intval(get_option('medium_size_w'));
		$max_height = intval(get_option('medium_size_h'));
^^ same code for medium and large
 
Yea, but you got an option in Admin UI to set thumbnail size
Settings > Media
 
ok, I debugged down to about same :)
 
i know that
 
did I mention that messing with native sizes is bad idea? proof
 
OK I no have to implement some code that checks those options and if not set to what I want then change them myself :P
 
1:20 PM
filter get_option() for those in addition to adding size... or just filter get option. dirty time
 
Yea, but don't alter anything
 
the reason why I didn't see this problem in the large and medium sizes is because what Im setting them to is smaller than the default sizes
 
Just add a message to wp_footer and admin_notices: "Brady, you've been a bad boy! I told you to stay away from defaults!".
 
how much I'd love to do that I cannot
so would it be wise to filter:
$pre = apply_filters( 'pre_option_' . $option, false );
 
yep
 
1:23 PM
joy to the world! there is some light at the end of the tunnel
 
@Brady Haven't you read the "Reserved Names" in Codex?
 
FU! ;)
 
;)
 
You should never try to mess with them.
lol
I'll do what I want!
 
need to change that italic to bold. and uppercase.
and obligatory kitten-will-die pic
 
1:26 PM
hahaha
I eat kittens for breakfast
 
I only know italic in wiki mark up :P
 
image management in WP is such a pain...
 
ha!
add_filter( 'pre_option_large_size_h', 'sc_hi_rezz_large_size' );
add_filter( 'pre_option_large_size_w', 'sc_hi_rezz_large_size' );
function sc_hi_rezz_large_size() { return 800; }
add_filter( 'pre_option_medium_size_h', 'sc_hi_rezz_medium_size' );
add_filter( 'pre_option_medium_size_w', 'sc_hi_rezz_medium_size' );
function sc_hi_rezz_medium_size() { return 414; }
add_filter( 'pre_option_thumbnail_size_h', 'sc_hi_rezz_thumbnail_size' );
add_filter( 'pre_option_thumbnail_size_w', 'sc_hi_rezz_thumbnail_size' );
^^ problem solved
you know I will come back to that in the future and I will be stuck for hours why image sizes aint obeying me
^^ will because of an undocumented hack like this
lunch time!
brb
thanks all for the help
 
@kaiser that is awesome :) made my day, LOL (literally)
 
1:38 PM
@Brady click "dirty hacks". You'll never forget again. :)
Anyone successful with alter admin css? This doesn't work for me (filter added on `login_init` hook):
function dump_admin_css( $src, $file )
{
var_dump( $src );
var_dump( $file );
return $src;
}
add_filter( 'wp_admin_css', 'dump_admin_css', 20, 2 );
Damn. Core sets $force_echo to true and bypasses the filter so half of the function will never work anywhere... omg
 
this is... CORE!!!
 
lol
 
on WPSE is it possible to un award an answer
 
1:53 PM
@Brady should be?.. can definitely change
 
1
Q: Set default image sizes in WordPress to hard crop

BradyHow do I set the medium and large images sizes in WP to hard crop? In my theme I can set the thumbnail size to hard crop using this: add_theme_support('post-thumbnails'); set_post_thumbnail_size( 96, 96, true ); But I can see no way to make the medium and large images to hard crop. Is there ...

any one want some extra points
^^ cos that answer isnt technically right after what I learnt today
 
Hm. How would I bring the admin bar to the login screen?
		show_admin_bar( true );
		add_action( 'login_head', '_wp_admin_bar_init' );
		add_action( 'login_head', 'wp_admin_bar_header' ); // remove bar for print
		add_action( 'login_head', '_admin_bar_bump_cb' );
		add_action( 'login_footer', 'wp_admin_bar_render' );
This drops a lot of stuff, but no styles...
 
why would u want admin bar on login screen?
 
because I got my dev menu added there
Helps me inspecting my theme hooks and such
 
 
2 hours later…
3:48 PM
in WP is it possible to get nav items to show selected status if on a single news item
I have the news page set to my page of posts
if I go to the news page the nav item gets the correct css class added to say im on the news page
but if I go to read a single post or go to an archive (selected category) the nav item loses its class
is there a way to retain this class on the menu?
 
4:07 PM
I hate that list() throws notices if array too short... makes me think how much I need to pad with empty
 
never ever used list in my own code
I must be missing out
 
it's great, but need to check that input makes sense
 
sweet there is a yubikey plugin for my yubikey :)
im impressed :)
 
4:32 PM
I will need to think about getting that one (as opposed to Google's app)... if I survive deadlines
 
dead easy to setup with my WP admin account.
the yubikey api is dead simple. I might look at adding this to one of my web apps
 
(non)unique keys in postmeta are confusing...
 
yeah
 

« first day (383 days earlier)      last day (4547 days later) »