How to Programically add to the new WordPress menus
You ca use the filters ‘wp_nav_menu_items’ and “wp_nav_menu_{$menu->slug}_items”. See ‘wp-includes/nav-menu-template.php’, line 222.
You ca use the filters ‘wp_nav_menu_items’ and “wp_nav_menu_{$menu->slug}_items”. See ‘wp-includes/nav-menu-template.php’, line 222.
For the first preference, you’d need to filter in additional rewrite rules like so; function __extra_country_rewrite_rules( $rules ) { global $wp_rewrite; if ( !isset( $wp_rewrite ) ) $wp_rewrite = new WP_Rewrite; $m1 = $wp_rewrite->preg_index(1); // preg match backreferences $m2 = $wp_rewrite->preg_index(2); $m3 = $wp_rewrite->preg_index(3); $rules[‘country/([^/]+)/([^/]+)s/feed/(feed|rdf|rss|rss2|atom)/?$’] = “index.php?country=$m1&post_type=$m2&feed=$m3”; $rules[‘country/([^/]+)/([^/]+)s/(feed|rdf|rss|rss2|atom)/?$’] = “index.php?country=$m1&post_type=$m2&feed=$m3”; $rules[‘country/([^/]+)/([^/]+)s/page/?([0-9]{1,})/?$’] = “index.php?country=$m1&post_type=$m2&paged=$m3”; $rules[‘country/([^/]+)/([^/]+)s/?$’] = … Read more
From your description, it seems like you would need 2 custom post types, one for the list of winners page and one for the individual winners. On the list of winners page type you can select which taxonomies you want to show (2009, Category). Then you can create a template that takes those taxonomy values … Read more
I don’t see this as excessively heavy. Just use is_user_logged_in() and current_user_can(). Obviously if user isn’t logged in then you can skip checking for any roles. I am not sure, but user data is probably held in memory so there will be no extra database calls and such.
In the case of custom fields- if you fetch them in a single query to the database, fetching one or ten is not going to differ much, it’s the same relatively simple query in both instances. If you were to do a lot of complex meta queries on those fields you’d definitely see a performance … Read more
You need to take a look at /core_root/wp-admin/includes/class-wp-terms-list-table.php and then add an extended class and make use of the WP_list_Table Class and documentation. basically you’re overriding the order and orderby in some custom plugin. Btw: “No Plugins” is never a good idea as plugins may show you how it works in code and therefore be … Read more
There is no default rewrite to a template for a category or taxonomy landing page. You are correct, that this can be done by creating a custom template and applying it to a page.
The easiest way would be to use a function which accepts a region taxonomy term as an argument, and outputs a list of posts with that term (i.e. ‘in that region’). So your template looks like: <!–nw–> <div id=”nw” class=”counties-container”> <h2>North West</h2> <p class=”nw-t”><?php my_posts_by_region(‘nw’); ?></p> </div> I’m assuming that ‘nw’ is the term name … Read more
You are using wp_set_object_terms wrong, the second parameter should be the term slug or id and the 3 parameter should be the taxonomy name, so try: function set_default_object_terms( $id, $post ) { if ( ‘publish’ === $post->post_status ) { log_me (‘be in function while “publish” i pressed with this id: ‘.$id); $taxonomy_ar = get_terms( ‘property-features’ … Read more
Just looking at the term_taxonomy table, you are selecting everything correctly, but the last part: WHERE $wpdb->posts.post_type=”publications” AND $wpdb->terms.slug = %s AND $wpdb->term_taxonomy.taxonomy = ‘category’ ORDER BY $wpdb->term_taxonomy.taxonomy = ‘topics’ DESC from the post_type of publications, the terms slug of %s, and has the taxonomy of categories, but you are never selecting the taxonomy topics. … Read more