Forum Replies Created

Viewing 15 replies - 1 through 15 (of 181 total)
  • 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.

    Plugin Author nickohrn

    (@nickohrn)

    @invot – thanks for your comments. I’ll see what I can do about updating the documentation sometime soon.

    You 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 🙁

    Plugin Author nickohrn

    (@nickohrn)

    Smashing, do you think you could let me know what you did and I can help you out?

    Plugin Author nickohrn

    (@nickohrn)

    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.

    Unfortunately there isn’t a filter that will let you actually remove the markup there. You can see on wp-login.php on lines 705-707 that those links are hard coded into the markup.

    If you’d like, you can create your own gallery markup using the post_gallery filter.

    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, and dd elements if you would like. You just need to pass the following attributes to the shortcode:

    * itemtag
    * icontag
    * captiontag

    Hope this helps!

    Unfortunately the widgets that are listed under “Available Widgets” are not sortable by you. They are displayed using the function wp_list_widgets which 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.

    Well, you can’t use sanitize_text_field because it removes the line breaks (and there’s no way to tell it not to). I’d recommend looking at the wp_kses family of functions and seeing if one of them fits your use case.

    Glad you figured it out 🙂

    Forum: Hacks
    In reply to: editing human_time_diff()

    Unfortunately human_time_diff doesn’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).

    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.

    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 abbr tags have been inserted appropriately.

    What 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.

    get_post_type should 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!

Viewing 15 replies - 1 through 15 (of 181 total)