Daniel Tan
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: How To Remove Extra Space on Right Side of Site?It looks like the Twitter @anywhere iframes are causing the scrollbars.
With Firebug I applied
display: none
to the iframes and the scrollbars disappeared. However they are generated with Twitter’s @anywhere JavaScript, so I’m not sure if_twttr_anywhere_client_1
will always remain the CSS ID for the iframe element(s, since I see 2 of them in Firebug).HTH
Forum: Fixing WordPress
In reply to: Dynamic Widget Classes for use in CSSI like to nitpick on my formatting: although the function code is readable and parseable by PHP I’m going to paste it again…
function my_widget_class($params) { global $widget_num; // Widget class $class = array(); $class[] = 'widget'; // Iterated class $widget_num++; $class[] = 'widget-' . $widget_num; // Alt class if ($widget_num % 2) : $class[] = 'insert-odd'; else : $class[] = 'insert-even'; endif; // Join the classes in the array $class = join(' ', $class); // Interpolate the 'my_widget_class' placeholder $params[0]['before_widget'] = str_replace('my_widget_class', $class, $params[0]['before_widget']); return $params; }
Forum: Fixing WordPress
In reply to: Dynamic Widget Classes for use in CSSI’m wondering if there’s some kind of filter I’m overlooking that would handle this.
I worked it out: it’s the
dynamic_sidebar_params
filter. Change your function to the following:
function my_widget_class($params) {
global $widget_num;// Widget class
$class = array();
$class[] = 'widget';// Iterated class
$widget_num++;
$class[] = 'widget-' . $widget_num;// Alt class
if ($widget_num % 2) :
$class[] = 'insert-even';
else :
$class[] = 'insert-odd';
endif;// Join the classes in the array
$class = join(' ', $class);// Interpolate the 'my_widget_class' placeholder
$params[0]['before_widget'] = str_replace('my_widget_class', $class, $params[0]['before_widget']);
return $params;
}(I fixed the confusion between odd and even, BTW.)
Your function is actually being called within
register_sidebar()
, so there isn’t any loop involved. We’ll use a placeholder CSS class called ‘my_widget_class’ instead. Change the ‘before_widget’ string to:
'before_widget' => '<div id="%1$s" class="%2$s my_widget_class">',
Then add this to the
dynamic_sidebar_params
filter:
add_filter('dynamic_sidebar_params', 'my_widget_class');
I tried it on my theme and it works flawlessly. For multiple sidebars, though,
$widget_num
will continue to increment instead of resetting at the first widget of a different sidebar.Since you only have one sidebar, that shouldn’t be a problem. Let me know if you have any issues with this.
Forum: Fixing WordPress
In reply to: Trackback comment bodies displaying differentlyAh, I see. No wonder pingbacks are so much more common, and pingback comment content contains the very link to posts.
Thanks for clearing this up!
Forum: Fixing WordPress
In reply to: Export posts of specific categoriesI think it might be because of Google Analytics because I see something like
<p><a href="[post permalink]/#more-371" class="more-link" onclick="javascript:urchinTracker ('/outbound/article/blog.NOVALISTIC.com');">(more…)</a></p>
in the source. Posts still get cut off after the more link.
Forum: Fixing WordPress
In reply to: Export posts of specific categoriesThe RSS feed doesn’t appear to contain comments for posts and I see the more link despite telling WordPress to display full posts in feeds. What should I do?
Forum: Fixing WordPress
In reply to: Export posts of specific categoriesHmmm, feeds… yeah I didn’t know there are category feeds. Thanks!
Forum: Plugins
In reply to: Stop Google Analytics from recording my own visitsAh, I was wondering what filters were for. Thanks! I’ve set a filter and I’ll see how things go.
@mendezki: I don’t use Ultimate Google Analytics :/
Forum: Installing WordPress
In reply to: Can I replace only the changed files for my 2.2.2 upgrade?I did exactly that when upgrading to 2.2.2. Really saves the hassle since I didn’t modify any of the core files.
Better watch out people. In each release, files don’t just get added and modified. They also get deleted.
I’ll keep that in mind, I believe the ChangeLog will tell us which files get deleted too ??
Forum: Installing WordPress
In reply to: WP doesn’t tell me it’s 2.2.1 but says it’s updatedHey thanks, apparently I told FileZilla to only overwrite files if newer instead of always, so the first transfer could’ve messed up and FZ would’ve refused to overwrite on the second upload.
WP is now upgraded!
Forum: Everything else WordPress
In reply to: Singapore WordPress CommunityI’m from Singapore ??