nickohrn
Forum Replies Created
-
accucomm – can you send me an email ([email protected]) about your problem? I’m curious why it is so slow for you – we made quite a few changes to try to increase the performance of the plugin.
@invot – thanks for your comments. I’ll see what I can do about updating the documentation sometime soon.
Forum: Hacks
In reply to: Change Sort Order of Image Attachment PagesYou shouldn’t need to pass any arguments to the custom functions, so can probably just do:
<?php previous_image_link_by_slug(); ?> <?php next_image_link_by_slug(); ?>That being said, I’d honestly have to do a lot more debugging to figure out what the issue is (if that doesn’t fix it) and I, unfortunately, don’t have the time right now. Sorry 🙁
Forum: Reviews
In reply to: [Multiple Featured Images: Reloaded] WTF?!Smashing, do you think you could let me know what you did and I can help you out?
Forum: Reviews
In reply to: [Multiple Featured Images: Reloaded] WTF?!Hey there! You contacted me via email and I’m happy to help however I can. Do you have a PHP error log that you could provide me? I copied the code from the readme.txt file into my local development site verbatim and nothing broke for me. Perhaps you copied it incorrectly?
Like I said, I’m happy to help however I can, but I need some more information.
Forum: Hacks
In reply to: Need to Remove Login and Lost Password Links from beneath "Register" formUnfortunately there isn’t a filter that will let you actually remove the markup there. You can see on
wp-login.phpon lines705-707that those links are hard coded into the markup.Forum: Hacks
In reply to: Default Gallery fails HTML validationIf you’d like, you can create your own gallery markup using the
post_galleryfilter.function custom_post_gallery($html, $attr) { return '<p>My super awesome gallery html.</p>'; } add_filter('post_gallery', 'custom_post_gallery', 10, 2);Other than that, you can choose to not use the
dd,dt, andddelements if you would like. You just need to pass the following attributes to the shortcode:*
itemtag
*icontag
*captiontagHope this helps!
Forum: Hacks
In reply to: Control display order of "available widgets" on widgets screenUnfortunately the widgets that are listed under “Available Widgets” are not sortable by you. They are displayed using the function
wp_list_widgetswhich can be found in/wp-admin/includes/widgets.php. In that function, the widgets are forcefully sorted by name before iterating through them.What I usually do when I have custom widgets (as part of a custom theme or whatever) is name them so they have a prefix: “My Theme Name: Custom Widget Name”. That leads to them all being grouped together.
Forum: Hacks
In reply to: sanitizing a text field form but keep line breaksWell, you can’t use
sanitize_text_fieldbecause it removes the line breaks (and there’s no way to tell it not to). I’d recommend looking at thewp_ksesfamily of functions and seeing if one of them fits your use case.Forum: Hacks
In reply to: wp stripping tags added by my plugin… where? how? why?Glad you figured it out 🙂
Forum: Hacks
In reply to: editing human_time_diff()Unfortunately
human_time_diffdoesn’t have a filter that you can hook into to provide what you’re looking for. The best thing you can probably do is copy the function code itself into a new function and use that instead:<?php function custom_human_time_diff( $from, $to = '' ) { if ( empty( $to ) ) $to = time(); $diff = (int) abs( $to - $from ); if ( $diff < 15 * MINUTE_IN_SECONDS ) { $since = __( 'a few minutes ago' ); } elseif ( $diff < HOUR_IN_SECONDS ) { $since = __( 'a half hour ago' ); } elseif ( $diff < DAY_IN_SECONDS && $diff >= HOUR_IN_SECONDS ) { $hours = round( $diff / HOUR_IN_SECONDS ); if ( $hours <= 1 ) $hours = 1; $since = sprintf( _n( '%s hour', '%s hours', $hours ), $hours ); } elseif ( $diff < WEEK_IN_SECONDS && $diff >= DAY_IN_SECONDS ) { $days = round( $diff / DAY_IN_SECONDS ); if ( $days <= 1 ) $days = 1; $since = sprintf( _n( '%s day', '%s days', $days ), $days ); } elseif ( $diff < 30 * DAY_IN_SECONDS && $diff >= WEEK_IN_SECONDS ) { $weeks = round( $diff / WEEK_IN_SECONDS ); if ( $weeks <= 1 ) $weeks = 1; $since = sprintf( _n( '%s week', '%s weeks', $weeks ), $weeks ); } elseif ( $diff < YEAR_IN_SECONDS && $diff >= 30 * DAY_IN_SECONDS ) { $months = round( $diff / ( 30 * DAY_IN_SECONDS ) ); if ( $months <= 1 ) $months = 1; $since = sprintf( _n( '%s month', '%s months', $months ), $months ); } elseif ( $diff >= YEAR_IN_SECONDS ) { $years = round( $diff / YEAR_IN_SECONDS ); if ( $years <= 1 ) $years = 1; $since = sprintf( _n( '%s year', '%s years', $years ), $years ); } return $since; }I’ve tried to meet your requirements with the above, but you might need to make modifications to cover the case of 16 – 29 minutes (which you didn’t explicitly mention in your original post).
Forum: Hacks
In reply to: wp stripping tags added by my plugin… where? how? why?This is an interesting issue! I’m not sure how much help I can be without seeing the theme itself, but let me think about it. I’ll try to post back within the next 24 hours.
Forum: Hacks
In reply to: wp stripping tags added by my plugin… where? how? why?If you’re transforming the HTML on the frontend, there’s no way that WordPress’s filtering system would be interfering with what you’re doing.
How are you getting that final paragraph’s source? Are you looking int he web inspector or using “View Source”? “View Source” won’t reflect changes made to the DOM.
Bring up the web inspector and run the following:
jQuery('#article-wrapper').find('abbr').size();That should at least let you know if the
abbrtags have been inserted appropriately.Forum: Hacks
In reply to: sanitizing a text field form but keep line breaksWhat are you trying to sanitize out of the field? sanitize_text_field forcefully strips out all new lines and tabs with a regex.
You may be better of using
wp_kses, elements depending on your specific use case.Forum: Hacks
In reply to: Remove "insert into button" in media uploader for custom post typesget_post_typeshould work in the admin without the need for a separate query:<?php function remove_insert_button_13247() { if('post' === get_post_type()) { echo '<style type="text/css">.media-frame a.button-primary { display: none; }</style>'; } } add_action('admin_head', 'remove_insert_button_13247');I just tested that and it removes the button in the post editing and adding interface but not so for pages. Take a look and let me know!