WordPress sitemap with Custom Post Types

Here is a quick crack at it, which should work in two level depth: <h2 id=”posts”>My Post Type</h2> <ul> <?php $not_in = array(); //to avoid naming the same post over and over //get top level terms $Parent_terms = get_terms( ‘my_taxonomy’, array(‘orderby’ => ‘name’,’parent’ => 0)); foreach ($Parent_terms as $term) { echo “<li><h3>”.$term->name.”</h3>”; echo “<ul>”; //get … Read more

Create list from custom field comma separated values

foreach($items as $item) { $item = nl2br($item); list($name,$src,$price,$desc) = explode(‘<br />’,$item); echo “<div class=\”item\”>”; echo “<h2>$name</h2>”; echo “<img src=\””.trim($src).”\” />”; echo “<br />Price: $price”; echo “<br />Description: $desc”; echo “</div><br />”; } This works if you have them hit enter after each value to make the list. http://vudu.me/f7 Is an article I wrote, and it … Read more

Do stuff when editing or writing a certain custom post type?

Here you go: add_action(“admin_print_scripts”,”load_my_script”); function load_my_script() { global $pagenow, $typenow; if (is_admin() && $pagenow==’post-new.php’ OR $pagenow==’post.php’ && $typenow==’Custom_post_type_name’) { wp_enqueue_script(‘jquery’); } } just change Custom_post_type_name to the actual name of your custom post type and enqueue your script.

Custom rewrite rule takes place AFTER the generic category rule

The answer I’ve come up with on my own I know is a really bad idea. But it works and I have to have a working solution. (Doesn’t mean I can’t fix the problem later…) add_filter(‘rewrite_rules_array’, ‘terminate_with_prejudice’); function terminate_with_prejudice($rules) { // if we don’t remove this we’ll never see our custom rule. unset($rules[‘(.+?)/?$’]); $rules = … Read more