Articles of customization

Multiple homes for multiple languages

I want to have multiples homes, for use multiples languages. For do for example: if($_SERVER[‘SERVER_NAME’] == ‘en.bz6.org’) defime(‘WPLANG’, ‘en’); else efime(‘WPLANG’, ‘es’);

wp_query to display custom taxonomy terms

I have a custom post type named ‘tours’ and custom taxonomy named ‘tourtypes’ so i can categorize it into terms like ‘cultural tour’, ‘sports tour’ etc. I’m not the original author of this theme and don not know much about dealing with taxonomy. But I want to extend it so that instead of outputting all […]

Using Shortcodes in WP-Menus in WP 3.1 (via nav_menu_objects)?

I’ve found this new plugin http://wpsmith.net/wordpress/creating-multiple-custom-menus-in-wordpress-3-1 that is using a new 3.1 hook (wp_nav_menu_objects) to remove specific nav-menu-items from the nav-menu-item array before they are parsed by the walker class, if a user isn’t logged in. The plugin uses a specific CSS-class as identifier to decide which items to remove. So I’ve been wondering if […]

Remove Author Slug & Replace With Username

I reviewed all related questions but none tackle this exactly so I’m posting the question in hopes the pro’s know how to handle this. I would like to change the author slug to remove the term /author/ completely like this; currently example.com/author/username want example.com/username Moreover I’d like all posts related to an author to look […]

Hide upload image fields for the different media upload popups

I am trying to change a few of the options in the Set Featured Image popup in the WordPress admin. I can’t seem to find anything that determines if the popup window is a Featured Image or an Add Media popup. I want to hide Align and Sizes fields for the Set Featured Image popup […]

Two Navigation Menus – secondary nav is including main nav

Two Navigation Menus in Themes Produce the same menus? reference the subject on page link above. i created two navs, yet the secondary nav includes all pages. the main nav is fine, but the secondary nav is including the main nav pages as well. the two menus contain only the pages i want per nav […]

Getting $comments outside the comment template

I have a ajax request hooked on “template_redirect” (the ajax requests the post’s url), and I want to display only the comment template: function get_comm(){ if(isset($_GET[‘get_my_comments’])): $offset = intval($_GET[‘get_my_comments’]); echo $offset; // offset will be the same as “cpage” global $comments, $wp_query, $post, $id; print_r($comments); // nothing ? print_r($wp_query->comments); // nothing ?? wp_list_comments(‘type=comment’, $comments); // […]

Image Editor does not affect custom sizes!

Recently working with wordpress 3.5, I came across this patch :http://core.trac.wordpress.org/ticket/19889 …which solved the problem of custom image sizes defined by my theme not resizing or rotating properly. The issue was image-edit.php did not account for sizes added by the function add_image_size (i think this is the name of the function but not 100% sure) […]

Custom Widget form function common elements

I am writing a set of custom widgets, all of which share a common 18 lines of code in the form() function, which looks like this: <div class=”common-section”> <input type=”hidden” class=”inputbox” name=”something” /> <?php $choices = [ ‘first’ => array(‘red’,’orange’,’blue’), ‘second’ => array(‘red’,’white’,’blue’), ‘third’ => array(‘green’,’black’,’white’) ]; ?> <?php foreach($choices as $colorset => $colors) : […]

How to add rewrite rules and pagination to retrieve attachments files?

I’m trying to list attachments based on different taxonomies. Right now it only work for the basic url (no pagination added). For example http://www.example.com/exams/high-school/city-name/subject/math/ First, I added my custom rewrite rule in functions.php as follows: function add_rewrite_rules($aRules) { $new_rules = array( // rule 1 ‘exams/([^/]+)/([^/]+)/subject/([^/]+)/?$’ => ‘index.php?pagename=exams&level=$matches[1]&city=$matches[2]&subject=$matches[3]’, // rule 2 ‘exams/([^/]+)/([^/]+)/subject/([^/]+)/page/([0-9]+)/?$’ => ‘index.php?pagename=exams&level=$matches[1]&city=$matches[2]&subject=$matches[3]&page=$matches[4]’ ); return […]