How to add custom HTML to wp_nav_menu?

The way WordPress goes through the menu pages to display the items, is using a walker object. In this case the specific class for this object is called Walker_Nav_Menu. You can find it in wp-includes\nav-menu-template.php. The Walker_Nav_Menu is a pretty simple class. You are able to see, how the links and the menu structure are … Read more

WordPress session management

It’s a very bad idea to modify WP Core files for the ability to use sessions. The best way I’ve found is to call the session_start() from init action hook. function kana_init_session() { session_start(); } add_action(‘init’, ‘kana_init_session’, 1); You can place it in functions.php file of your theme. Detailed article can be found here: http://www.kanasolution.com/2011/01/session-variable-in-wordpress/

Remove category and tag base from WordPress URLs without a plugin?

If you want to remove /category/ from the url, follow these two steps: Go to Settings >> Permalinks and select Custom and enter: /%category%/%postname%/ Next set your Category Base to . Save it and you’ll see your URL changed to this format: http://yourblog.com/quotes/ (Source: http://premium.wpmudev.org/blog/daily-tip-quick-trick-to-remove-category-from-wordpress-url/)

Exclude a folder/directory from RewriteRule

You may try replacing the complete WP rule-set with this one: # BEGIN WordPress RewriteEngine On RewriteBase / RewriteRule ^index.php$ – [L] # Include in the next line all folders to exclude RewriteCond %{REQUEST_URI} !(folder1|folder2|folder3) [NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] # END WordPress

How to fetch a wordpress admin page using google apps script?

There might be an issue with Google Apps Scripts and post-ing to a URL that gives you back a redirection header. It seems like it might not be possible to follow the redirect with a post – here’s a discussion on the issue – https://issuetracker.google.com/issues/36754794 Would it be possible, if you modify your code to … Read more

Woocommerce get variation product price

Here is the code you are looking for add_filter( ‘woocommerce_variation_option_name’, ‘display_price_in_variation_option_name’ ); function display_price_in_variation_option_name( $term ) { global $wpdb, $product; if ( empty( $term ) ) return $term; if ( empty( $product->id ) ) return $term; $id = $product->get_id(); $result = $wpdb->get_col( “SELECT slug FROM {$wpdb->prefix}terms WHERE name=”$term”” ); $term_slug = ( !empty( $result ) … Read more

Relative URLs in WordPress

I think this is the kind of question only a core developer could/should answer. I’ve researched and found the core ticket #17048: URLs delivered to the browser should be root-relative. Where we can find the reasons explained by Andrew Nacin, lead core developer. He also links to this [wp-hackers] thread. On both those links, these … Read more