Skip to content

Month: October 2010

How to remove the Itemid from the links of swMenuPro when you use it to show Virtuemart categories or products?

A strange problem apeared for me when I use swMenuPro to show the Virtuemart products or categories. The problem is that when I click to an link from the menu I go to the category (or product), but the Itemid stays the same as from the previus page, but I needed to change the Itemid or the Virtuemart page.
To do this go to yoursite.com/modules/mod_swmenupro/functions.php and around line 237 and 253 there should be the link (on two places):

$url="index.php?option=com_virtuemart&page=shop.product_details&flypage=shop.flypage&product_id=".$result4->product_id."&category_id=" . $result4->category_id . "&manufacturer_id=".$result4->vendor_id."&Itemid=".($Itemid)."&swid=".($result4->product_id+100000);

So just remove the Itemid or put your value.

How to style wordpress default comment form for TwentyTen?

Go to your theme open comments.php if you have one:

and find the line:

comment_form();

Replace it with this code which you could change as you like:

$commenter = wp_get_current_commenter();

$fields =  array(
 'author' => '<p>' . '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /><label for="author">' . __( 'Name' ) . '</label> ' . ( $req ? '<span>*</span>' : '' ) .
 '</p>',
 'email'  => '<p><input id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /><label for="email">' . __( 'Email' ) . '</label> ' . ( $req ? '<span>*</span>' : '' ) .
 '</p>',
 'url'    => '<p><input id="url" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /><label for="url">' . __( 'Website' ) . '</label>' .
 '</p>',
);

$defaults = array(
 'fields'               => apply_filters( 'comment_form_default_fields', $fields ),
);

comment_form($defaults);

For more information check the wordpress docs: http://codex.wordpress.org/Template_Tags/comment_form

How wordpress more link can navigate to top of the full article window?

By default, when you click on the Read More link, the web page loads and then “jumps” to the spot where the <–more–> tag is set in the post. If you do not want that “jump”, you can use this code in your theme’s functions.php:

function remove_more_jump_link($link) {
$offset = strpos($link, '#more-');
if ($offset) {
$end = strpos($link, '"',$offset);
}
if ($end) {
$link = substr_replace($link, '', $offset, $end-$offset);
}
return $link;
}
add_filter('the_content_more_link', 'remove_more_jump_link');

Function to get wordpress theme URL

This function will return the theme directory URL so you can use it in other functions:

get_bloginfo('template_directory');

Alternatively, this function will echo the theme directory URL to the browser:

bloginfo('template_directory');

So an example for an image in the themes images/headers folder would be:

<img src="<?php bloginfo('template_directory'); ?>/images/headers/image.jpg" />