• Resolved shetakaey

    (@shetakaey)


    I have been hacking the functions.php file for the past several WP upgrades in order to insert an expanded and custom smiley group, and it’s been working just fine until 2.8. Now when I hack the functions.php file by copy/pasting my old file (just the portion with the smiley codes), it kills my blog (white screen of death) or, if I add the line regarding $wp_smiliesreplace, my blog is there but the posts and comments are blank.

    I’m obviously missing something, and I don’t know enough about php to write my own plugin. Can anyone advise what I need to do to get this working? Thanks!

Viewing 15 replies - 1 through 15 (of 18 total)
  • If you can post the code you use, i can test and see if i can get it working again for you…

    ??

    Thread Starter shetakaey

    (@shetakaey)

    I use the functions.php code as is from the wp-includes directory, with my own smilies — relevant portion below.

    /**
     * Convert smiley code to the icon graphic file equivalent.
     *
     * You can turn off smilies, by going to the write setting screen and unchecking
     * the box, or by setting 'use_smilies' option to false or removing the option.
     *
     * Plugins may override the default smiley list by setting the $wpsmiliestrans
     * to an array, with the key the code the blogger types in and the value the
     * image file.
     *
     * The $wp_smiliessearch global is for the regular expression and is set each
     * time the function is called.
     *
     * The full list of smilies can be found in the function and won't be listed in
     * the description. Probably should create a Codex page for it, so that it is
     * available.
     *
     * @global array $wpsmiliestrans
     * @global array $wp_smiliessearch
     * @since 2.2.0
     */
    function smilies_init() {
    	global $wpsmiliestrans, $wp_smiliessearch;
    
    	// don't bother setting up smilies if they are disabled
    	if ( !get_option( 'use_smilies' ) )
    		return;
    
    	if ( !isset( $wpsmiliestrans ) ) {
    		$wpsmiliestrans = array(
    		'%%' => '4leafclover.gif',
    		'*clover*' => '4leafclover.gif',
    		'*alien*' => 'alien.gif',
    		'>-)' => 'alien.gif',
    		'O:-)' => 'angel.gif',
    		'O:)' => 'angel.gif',
    		'*angel*' => 'angel.gif',
    		'*innocent*' => 'angel.gif',
    		'X(' => 'angry.gif',
    		'x(' => 'angry.gif',
    		'X-(' => 'angry.gif',
    		'x-(' => 'angry.gif',
    		'*mad*' => 'angry.gif',
    		'*fumes*' => 'angry.gif',
    		'*mad*' => 'icon_mad.gif',
    		'=D>' => 'applause.gif',
    		'*applause*' => 'applause.gif',
    		'*claps*' => 'applause.gif',
    		'~X(' => 'atwitsend.gif',
    		'~x(' => 'atwitsend.gif',
    		'*at wits end*' => 'atwitsend.gif',
    		';;)' => 'battingeyelashes.gif',
    		'*bats eyelashes*' => 'battingeyelashes.gif',
    		'b-(' => 'beatup.gif',
    		'*punch*' => 'beatup.gif',
    		'*bee*' => 'bee.gif',
    		':bz' => 'bee.gif',
    		':-D' => 'biggrin.gif',
    		':D' => 'biggrin.gif',
    		'*grin*' => 'biggrin.gif',
    		'*big grin*' => 'biggrin.gif',
    		':grin:' => 'icon_biggrin.gif',
    		'>:D<' => 'bighug.gif',
    		'*hug*' => 'bighug.gif',
    		'*hugs*' => 'bighug.gif',
    		'*blush*' => 'blushing.gif',
    		':oops:' => 'blushing.gif',
    		'>:/' => 'bringiton.gif',
    		'=((' => 'brokenheart.gif',
    		'*bug*' => 'bug.gif',
    		'=:)' => 'bug.gif',
    		':-c' => 'callme.gif',
    		':-C' => 'callme.gif',
    		':c' => 'callme.gif',
    		':C' => 'callme.gif',
    		'*call me*' => 'callme.gif',
    		':-@' => 'chatterbox.gif',
    		':@' => 'chatterbox.gif',
    		'*chatterbox*' => 'chatterbox.gif',
    		'~:>' => 'chicken.gif',
    		'*chicken*' => 'chicken.gif',
    		':O)' => 'clown.gif',
    		'*clown*' => 'clown.gif',
    		'~O)' => 'coffee.gif',
    		'*coffee*' => 'coffee.gif',
    		'*confused*' => 'confused.gif',
    		':-???' => 'confused.gif',
    		':???' => 'confused.gif',
    		':???:' => 'icon_confused.gif',
    		'B-)' => 'cool.gif',
    		'B)' => 'cool.gif',
    		'*is cool*' => 'cool.gif',
    		'8)' => 'icon_cool.gif',
    		':cool:' => 'icon_cool.gif',
    		'8-)' => 'icon_cool.gif',
    		'3:-O' => 'cow.gif',
    		'*cow*' => 'cow.gif',
    		'<):)' => 'cowboy.gif',
    		'*cowboy*' => 'cowboy.gif',
    		':((' => 'crying.gif',
    		'*cries*' => 'crying.gif',
    		':cry:' => 'icon_cry.gif',
    		'\:D/' => 'dancing.gif',
    		'*dances*' => 'dancing.gif',
    		'8->' => 'daydreaming.gif',
    		'8>' => 'daydreaming.gif',
    		'*daydreams*' => 'daydreaming.gif',
    		'>:)' => 'devil.gif',
    		'>:-)' => 'devil.gif',
    		'*evil*' => 'devil.gif',
    		':evil:' => 'icon_evil.gif',
    		'#-o' => 'doh.gif',
    		'#o' => 'doh.gif',
    		'#O' => 'doh.gif',
    		'#-O' => 'doh.gif',
    		'*doh*' => 'doh.gif',
    		'*doh!*' => 'doh.gif',
    		'=P~' => 'drooling.gif',
    		'=p~' => 'drooling.gif',
    		'*drools*' => 'drooling.gif',
    		'/:)' => 'eyebrow.gif',
    		'*eyebrow*' => 'eyebrow.gif',
    		'*raises eyebrow*' => 'eyebrow.gif',
    		':-L' => 'frustrated.gif',
    		':L' => 'frustrated.gif',
    		'*frustrated*' => 'frustrated.gif',
    		':smile:' => 'icon_smile.gif',
    		'*smile*' => 'happy.gif',
    		'*smiles*' => 'happy.gif',
    		':-)' => 'happy.gif',
    		':)' => 'happy.gif',
    		'X_X' => 'hideseyes.gif',
    		'x_x' => 'hideseyes.gif',
    		'*hides*' => 'hideseyes.gif',
    		'*hides eyes*' => 'hideseyes.gif',
    		':!!' => 'hurryup.gif',
    		':-!!' => 'hurryup.gif',
    		'*hurry*' => 'hurryup.gif',
    		'*hurry up*' => 'hurryup.gif',
    		'@-)' => 'hypnotized.gif',
    		'@)' => 'hypnotized.gif',
    		'*hypnotized*' => 'hypnotized.gif',
    		'*-:)' => 'idealightbulb.gif',
    		'*idea*' => 'idealightbulb.gif',
    		':idea:' => 'icon_idea.gif',
    		':-??' => 'Idontknow.gif',
    		':??' => 'Idontknow.gif',
    		'*dunno*' => 'Idontknow.gif',
    		':-*' => 'kiss.gif',
    		':*' => 'kiss.gif',
    		'*kiss*' => 'kiss.gif',
    		'*smooch*' => 'kiss.gif',
    		':))' => 'laughing.gif',
    		':-))' => 'laughing.gif',
    		'*lol*' => 'laughing.gif',
    		'*laugh*' => 'laughing.gif',
    		':lol:' => 'icon_lol.gif',
    		':^o' => 'liar.gif',
    		':^O' => 'liar.gif',
    		'*liar*' => 'liar.gif',
    		'L-)' => 'loser.gif',
    		'L)' => 'loser.gif',
    		'*loser*' => 'loser.gif',
    		':x' => 'lovestruck.gif',
    		':-x' => 'lovestruck.gif',
    		':-X' => 'lovestruck.gif',
    		':X' => 'lovestruck.gif',
    		'*love*' => 'lovestruck.gif',
    		'$-)' => 'moneyeyes.gif',
    		'$)' => 'moneyeyes.gif',
    		'*money*' => 'moneyeyes.gif',
    		':(|)' => 'monkey.gif',
    		'*monkey*' => 'monkey.gif',
    		':-SS' => 'nailbiting.gif',
    		':SS' => 'nailbiting.gif',
    		':-ss' => 'nailbiting.gif',
    		':ss' => 'nailbiting.gif',
    		'*bites nails*' => 'nailbiting.gif',
    		':-B' => 'nerd.gif',
    		':B' => 'nerd.gif',
    		':-b' => 'nerd.gif',
    		':b' => 'nerd.gif',
    		'*nerd*' => 'nerd.gif',
    		'%-(' => 'notlistening.gif',
    		'%(' => 'notlistening.gif',
    		'*not listening*' => 'notlistening.gif',
    		'^#(^' => 'notme.gif',
    		'*not me*' => 'notme.gif',
    		'[-(' => 'nottalking.gif',
    		'*shakes head*' => 'nottalking.gif',
    		'^:)^' => 'notworthy.gif',
    		'*not worthy' => 'notworthy.gif',
    		':-j' => 'ohgoon.gif',
    		':j' => 'ohgoon.gif',
    		'*oh go on*' => 'ohgoon.gif',
    		':)]' => 'onphone.gif',
    		'*phone hang on*' => 'onphone.gif',
    		'*phone*' => 'onphone.gif',
    		'<:-P' => 'party.gif',
    		'*party*' => 'party.gif',
    		'*noisemaker*' => 'party.gif',
    		':)>-' => 'peacesign.gif',
    		'*peace*' => 'peacesign.gif',
    		'*victory*' => 'peacesign.gif',
    		'>:P' => 'phbbbt.gif',
    		'>:-P' => 'phbbbt.gif',
    		'*phbbbt*' => 'phbbbt.gif',
    		'*raspberry*' => 'phbbbt.gif',
    		':@)' => 'pig.gif',
    		'*pig*' => 'pig.gif',
    		':ar!' => 'pirate.gif',
    		'*pirate*' => 'pirate.gif',
    		'[-O<' => 'praying.gif',
    		'*prays*' => 'praying.gif',
    		'(~~)' => 'pumpkin.gif',
    		'*pumpkin*' => 'pumpkin.gif',
    		':o3' => 'puppyeyes.gif',
    		'*puppy eyes*' => 'puppyeyes.gif',
    		'\m/' => 'rockon.gif',
    		'*rocks out*' => 'rockon.gif',
    		'=))' => 'rofl.gif',
    		'*rofl*' => 'rofl.gif',
    		'*lmao*' => 'rofl.gif',
    		'8-|' => 'rollingeyes.gif',
    		'*rolls eyes*' => 'rollingeyes.gif',
    		'*eyeroll*' => 'rollingeyes.gif',
    		':roll:' => 'icon_rolleyes.gif',
    		'@};-' => 'rose.gif',
    		'*rose*' => 'rose.gif',
    		':(' => 'sad.gif',
    		':-(' => 'sad.gif',
    		'*sad*' => 'sad.gif',
    		':sad:' => 'icon_sad.gif',
    		'[-X' => 'shameonyou.gif',
    		'[X' => 'shameonyou.gif',
    		'*shame*' => 'shameonyou.gif',
    		'*tsk*' => 'shameonyou.gif',
    		':-&' => 'sick.gif',
    		':&' => 'sick.gif',
    		'*sick*' => 'sick.gif',
    		'*retch*' => 'sick.gif',
    		'*green*' => 'sick.gif',
    		'*eww*' => 'sick.gif',
    		':-<' => 'sigh.gif',
    		':<' => 'sigh.gif',
    		'*sigh*' => 'sigh.gif',
    		'8-}' => 'silly.gif',
    		'*silly*' => 'silly.gif',
    		'8-X' => 'skull.gif',
    		'*skull*' => 'skull.gif',
    		'I-)' => 'sleepy.gif',
    		'i-)' => 'sleepy.gif',
    		'I)' => 'sleepy.gif',
    		'i)' => 'sleepy.gif',
    		'*sleepy*' => 'sleepy.gif',
    		':-$' => 'ssshhhh.gif',
    		':$' => 'ssshhhh.gif',
    		'*shh*' => 'ssshhhh.gif',
    		'*shhh*' => 'ssshhhh.gif',
    		'(*)' => 'star.gif',
    		'*star*' => 'star.gif',
    		'*gold star*' => 'star.gif',
    		':-/' => 'straightface.gif',
    		':/' => 'straightface.gif',
    		':|' => 'straightface.gif',
    		':-|' => 'straightface.gif',
    		'*frowns*' => 'straightface.gif',
    		'*frown*' => 'straightface.gif',
    		':neutral:' => 'icon_neutral.gif',
    		':O' => 'surprised.gif',
    		':-O' => 'surprised.gif',
    		':o' => 'surprised.gif',
    		':-o' => 'surprised.gif',
    		'*omg*' => 'surprised.gif',
    		':eek:' => 'icon_surprised.gif',
    		':shock:' => 'icon_eek.gif',
    		'8-O' => 'icon_eek.gif',
    		'8O' => 'icon_eek.gif',
    		'=;' => 'talktothehand.gif',
    		'*talk to the hand*' => 'talktothehand.gif',
    		';))' => 'teehee.gif',
    		'*tee hee*' => 'teehee.gif',
    		'*giggle*' => 'teehee.gif',
    		':-?' => 'thinking.gif',
    		':?' => 'thinking.gif',
    		'*thinks*' => 'thinking.gif',
    		':-q' => 'thumbsdown.gif',
    		'*thumbs down*' => 'thumbsdown.gif',
    		':-bd' => 'thumbsup.gif',
    		'*thumbs up*' => 'thumbsup.gif',
    		':-t' => 'timeout.gif',
    		'*time out*' => 'timeout.gif',
    		'*timeout*' => 'timeout.gif',
    		':P' => 'tongue.gif',
    		':-P' => 'tongue.gif',
    		'*tongue*' => 'tongue.gif',
    		':razz:' => 'icon_razz.gif',
    		':>' => 'wagglingeyebrows.gif',
    		':->' => 'wagglingeyebrows.gif',
    		'*waggle*' => 'wagglingeyebrows.gif',
    		':-w' => 'waiting.gif',
    		'*drums fingers*' => 'waiting.gif',
    		'*waits*' => 'waiting.gif',
    		':-h' => 'wave.gif',
    		'*wave*' => 'wave.gif',
    		'*waves*' => 'wave.gif',
    		'#:-S' => 'whew.gif',
    		'*whew*' => 'whew.gif',
    		'*whistles*' => 'whistling.gif',
    		';)' => 'wink.gif',
    		';-)' => 'wink.gif',
    		'*wink*' => 'wink.gif',
    		'*winks*' => 'wink.gis',
    		':wink:' => 'icon_wink.gif',
    		':-S' => 'worried.gif',
    		':-s' => 'worried.gif',
    		':S' => 'worried.gif',
    		':s' => 'worried.gif',
    		'*worries*' => 'worried.gif',
    		'(:|' => 'yawn.gif',
    		'*yawn*' => 'yawn.gif',
    		'*yawns*' => 'yawns.gif',
    		'(%)' => 'yinyang.gif',
    		'*yin yang*' => 'yinyang.gif',
    		':mrgreen:' => 'icon_mrgreen.gif',
    		':twisted:' => 'icon_twisted.gif',
    		':arrow:' => 'icon_arrow.gif',
    		':!:' => 'icon_exclaim.gif',
    		':?:' => 'icon_question.gif',
    		);
    	}
    
    	if (count($wpsmiliestrans) == 0) {
    		return;
    	}
    
    	/*
    	 * NOTE: we sort the smilies in reverse key order. This is to make sure
    	 * we match the longest possible smilie (:???: vs :?) as the regular
    	 * expression used below is first-match
    	 */
    	krsort($wpsmiliestrans);
    
    	$wp_smiliessearch = '/(?:\s|^)';
    
    	$subchar = '';
    	foreach ( (array) $wpsmiliestrans as $smiley => $img ) {
    		$firstchar = substr($smiley, 0, 1);
    		$rest = substr($smiley, 1);
    
    		// new subpattern?
    		if ($firstchar != $subchar) {
    			if ($subchar != '') {
    				$wp_smiliessearch .= ')|(?:\s|^)';
    			}
    			$subchar = $firstchar;
    			$wp_smiliessearch .= preg_quote($firstchar, '/') . '(?:';
    		} else {
    			$wp_smiliessearch .= '|';
    		}
    		$wp_smiliessearch .= preg_quote($rest);
    	}
    
    	$wp_smiliessearch .= ')(?:\s|$)/m';
    }

    That’s probably way more than you needed to see. ??
    Thanks!

    Ok but what’s your usage, are you modifying this file directly or are you copying this code to your theme functions file?

    Thread Starter shetakaey

    (@shetakaey)

    I’m downloading the file and making the changes, then uploading the new version.

    It seems to fall over on the smilies that have dashes from what i can tell….

    I’d suggest adding them back in bulks of 5, testing as you go….

    I’d love to help more, but there’s no chance i’m sitting there testing “that many” smilies one or 5 at a time…

    Start with the original file, then add 1, 2 (or 5)? or so back at a time, and test the page as you do it, when it chucks up an error or blank page, you know specifically which group (or particular) smiley is causing the problem…

    Thread Starter shetakaey

    (@shetakaey)

    I’ll give it a try, and post my results here. Thanks.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    Yikes! You’ve been modifying that file every version? Why? You can simply override it in a plugin and never have to modify it again.

    1. Make a plugin.

    2. In there, put this code:

    /*
    Plugin Name: My Custom Smilies
    */
    global $wpsmiliestrans;
    
    $wpsmiliestrans = array (
    ... stuff just like in the functions.php but with your changes ...
    );

    Voila.

    Good idea…

    You’ll still have the same issue in any case, but that should mean no more core edits at least… yippee!!! ??

    Thread Starter shetakaey

    (@shetakaey)

    Okay, here’s what I’m finding. The old functions.php contained this code:

    Convert smiley code to the icon graphic file equivalent.
     *
     * You can turn off smilies, by going to the write setting screen and unchecking
     * the box, or by setting 'use_smilies' option to false or removing the option.
     *
     * Plugins may override the default smiley list by setting the $wpsmiliestrans
     * to an array, with the key the code the blogger types in and the value the
     * image file.
     *
     * The $wp_smiliessearch global is for the regular expression array and is
     * set each time the function is called. The $wp_smiliesreplace is the full
     * replacement. Supposely, the $wp_smiliessearch array is looped over using
     * preg_replace() or just setting the array of $wp_smiliessearch along with the
     * array of $wp_smiliesreplace in the search and replace parameters of
     * preg_replace(), which would be faster and less overhead. Either way, both are
     * used with preg_replace() and can be defined after the function is called.
     *
     * The full list of smilies can be found in the function and won't be listed in
     * the description. Probably should create a Codex page for it, so that it is
     * available.
     *
     * @global array $wpsmiliestrans
     * @global array $wp_smiliesreplace
     * @global array $wp_smiliessearch
     * @since 2.2.0
     */
    function smilies_init() {
    	global $wpsmiliestrans, $wp_smiliessearch, $wp_smiliesreplace;
    
    	// don't bother setting up smilies if they are disabled
    	if ( !get_option( 'use_smilies' ) )
    		return;
    
    	if ( !isset( $wpsmiliestrans ) ) {
    		$wpsmiliestrans = array(
    		[CLIPPED SMILEY CODES FOR BREVITY]
    		);
    	}
    
    	$siteurl = get_option( 'siteurl' );
    	foreach ( (array) $wpsmiliestrans as $smiley => $img ) {
    		$wp_smiliessearch[] = '/(\s|^)' . preg_quote( $smiley, '/' ) . '(\s|$)/';
    		$smiley_masked = attribute_escape( trim( $smiley ) );
    		$wp_smiliesreplace[] = " <img src='$siteurl/wp-includes/images/smilies/$img' alt='$smiley_masked' class='wp-smiley' /> ";
    	}
    }
    
    /**
     * Merge user defined arguments into defaults array.
     *
     * This function is used throughout WordPress to allow for both string or array
     * to be merged into another array.
     *
     * @since 2.2.0
     *
     * @param string|array $args Value to merge with $defaults
     * @param array $defaults Array that serves as the defaults.
     * @return array Merged user defined values with defaults.
     */
    function wp_parse_args( $args, $defaults = '' ) {
    	if ( is_object( $args ) )
    		$r = get_object_vars( $args );
    	elseif ( is_array( $args ) )
    		$r =& $args;
    	else
    		wp_parse_str( $args, $r );
    
    	if ( is_array( $defaults ) )
    		return array_merge( $defaults, $r );
    	return $r;
    }
    
    /*

    and the new looks like this, below, which takes away my ability to use my own smilies with my own codes:

    /**
     * Convert smiley code to the icon graphic file equivalent.
     *
     * You can turn off smilies, by going to the write setting screen and unchecking
     * the box, or by setting 'use_smilies' option to false or removing the option.
     *
     * Plugins may override the default smiley list by setting the $wpsmiliestrans
     * to an array, with the key the code the blogger types in and the value the
     * image file.
     *
     * The $wp_smiliessearch global is for the regular expression and is set each
     * time the function is called.
     *
     * The full list of smilies can be found in the function and won't be listed in
     * the description. Probably should create a Codex page for it, so that it is
     * available.
     *
     * @global array $wpsmiliestrans
     * @global array $wp_smiliessearch
     * @since 2.2.0
     */
    function smilies_init() {
    	global $wpsmiliestrans, $wp_smiliessearch;
    
    	// don't bother setting up smilies if they are disabled
    	if ( !get_option( 'use_smilies' ) )
    		return;
    
    	if ( !isset( $wpsmiliestrans ) ) {
    		$wpsmiliestrans = array(
    		[CLIPPED SMILEY CODES AGAIN AS ABOVE]
    		);
    	}
    
    	if (count($wpsmiliestrans) == 0) {
    		return;
    	}
    
    	/*
    	 * NOTE: we sort the smilies in reverse key order. This is to make sure
    	 * we match the longest possible smilie (:???: vs :?) as the regular
    	 * expression used below is first-match
    	 */
    	krsort($wpsmiliestrans);
    
    	$wp_smiliessearch = '/(?:\s|^)';
    
    	$subchar = '';
    	foreach ( (array) $wpsmiliestrans as $smiley => $img ) {
    		$firstchar = substr($smiley, 0, 1);
    		$rest = substr($smiley, 1);
    
    		// new subpattern?
    		if ($firstchar != $subchar) {
    			if ($subchar != '') {
    				$wp_smiliessearch .= ')|(?:\s|^)';
    			}
    			$subchar = $firstchar;
    			$wp_smiliessearch .= preg_quote($firstchar, '/') . '(?:';
    		} else {
    			$wp_smiliessearch .= '|';
    		}
    		$wp_smiliessearch .= preg_quote($rest);
    	}
    
    	$wp_smiliessearch .= ')(?:\s|$)/m';
    }
    
    /**
     * Merge user defined arguments into defaults array.
     *
     * This function is used throughout WordPress to allow for both string or array
     * to be merged into another array.
     *
     * @since 2.2.0
     *
     * @param string|array $args Value to merge with $defaults
     * @param array $defaults Array that serves as the defaults.
     * @return array Merged user defined values with defaults.
     */
    function wp_parse_args( $args, $defaults = '' ) {
    	if ( is_object( $args ) )
    		$r = get_object_vars( $args );
    	elseif ( is_array( $args ) )
    		$r =& $args;
    	else
    		wp_parse_str( $args, $r );
    
    	if ( is_array( $defaults ) )
    		return array_merge( $defaults, $r );
    	return $r;
    }

    I’ve been trying to figure it out but I don’t know php. The main question for me at the moment is this: If I replace the new code — in full — with the old code, will it break anything else? How many other files would require changes to work? I am very fond of my smilies and I went to a great deal of trouble to code pretty much every possible configuration that someone might use in comments, to ensure that my smilies show up for various typed emotes.

    I realize this is not a crucial issue but dammit, why <strike>break</strike> change a code that worked just fine? I’m spending a lot of time (off and on) trying to figure this out and really won’t be happy if I can’t use my own smiley set. ??

    Thanks for your patience.

    Thread Starter shetakaey

    (@shetakaey)

    Oh and an addendum — it’s not the smilies with dashes, since the default WP smilies also use dashes. It appears to be an issue with wp_smiliesreplace being omitted from the new version.

    Thread Starter shetakaey

    (@shetakaey)

    To Otto42: I saw that code hack on the Ars Aranea forum, but I really don’t know what to put in place of “…stuff just like in the functions.php but with your changes.” lol. I’m a PHP Noob all the way.

    When i say dash i actually mean slashes, sorry, forward and backslash…

    / and \

    I did spend a few minutes on it and removing certain chunks of the code got it up and running… (too many to keep doing remove, add, remove add, lol…)

    It just seemed that smilies with dashes (EDIT: oops, sorry slashes) were more prevalent in the chunks i removed… i could be wrong of course…

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    The smilies replacement code no longer uses that wp_smiliesreplace, and it’s moved around. And there’s nothing wrong with the new version, because the new version works just fine. The reason it was changed is because the new version is much, much faster.

    The problem is that you’re changing something, we have no idea what it is, and your site breaks because you’re changing it wrong.

    Stop changing things in the core and things won’t get broken.

    Now, work on the actual problem. The problem is not that your site breaks, the problem is that you want to add a whole mess of smilies. Fine, we get that. Here’s the CORRECT way to do it:

    1. Make a plugin file. Call it mysmilies.php and put it in the plugins directory.

    2. Put this code in that file:

    /*
    Plugin Name: My Custom Smilies
    */
    global $wpsmiliestrans;
    
    $wpsmiliestrans = array(
    	':mrgreen:' => 'icon_mrgreen.gif',
    	':neutral:' => 'icon_neutral.gif',
    	':twisted:' => 'icon_twisted.gif',
    	':arrow:' => 'icon_arrow.gif',
    	':shock:' => 'icon_eek.gif',
    	':smile:' => 'icon_smile.gif',
    );

    3. Replace the example smilies I just put in there with your own.

    4. Activate the plugin.

    That’s all you have to do. Put the original functions.php file back in and then write “I will not modify core code” on a piece of paper 100 times. ??

    Thread Starter shetakaey

    (@shetakaey)

    Otto42: I accept your chiding with good grace, and thank you for the specifics. ?? I need to study up on php. I did have to check another php file for the opening and closing codes. ??

    t31os: Yes, you were correct in that it was the slashes breaking the smiley code. Alas. But thankfully this whole fiasco resulted in a plugin that keeps me from having to do this again later. ??

    Thanks to both of you — it’s working now. I appreciate the assistance and your continuing patience.

    Good stuff… ??

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Changes in Smileys hack for 2.8’ is closed to new replies.