stevecoy
Forum Replies Created
-
Forum: Hacks
In reply to: Category permalinks with custom post typesbcworkz, thanks for the help. I got it working by putting this in functions.php:
add_action( 'init', 'video_rewrite_rule'); function video_rewrite_rule() { add_rewrite_tag('%videos%','true'); add_rewrite_tag('%category%','([^&]+)'); add_rewrite_tag('%li_video%','([^&]+)'); add_rewrite_rule( '^videos/category([^/]*)/([^/]*)/?', 'index.php?videos=true&category=$matches[2]&li_video=$matches[3]', 'top'); //flush_rewrite_rules(); leave this in once and then comment it out } add_action( 'pre_get_posts', 'video_query_edit',1); function video_query_edit($query){ if (!empty($query->query_vars['videos']) && isset($query->query_vars['category'])) { $query->set('post_type', 'li_video' ); //$query->set('posts_per_page', 10 ); $query->set('category_name',$query->query_vars['category']); } } add_filter('template_redirect', 'video_template_redirect'); function video_template_redirect(){ //this is what tells the page to use the archive-li_video.php in the theme, you could also do archive.php or whatever global $wp_query; if (!empty($wp_query->query_vars['videos']) && isset($wp_query->query_vars['category'])) { include( get_template_directory() . '/archive-li_video.php' ); exit; } }I got part of this from this article: http://pippinsplugins.com/wordpress-rewrite-api-part-2/ (costs $6 to be able to view it)
You can obviously modify the particulars to use different custom post types. There, I just saved the WP community $6 and countless hours!
Forum: Plugins
In reply to: [Page Links To] [Plugin: Page Links To] Slash "/" added to end of URLCheck your permalink settings. Is there a trailing slash at the end of your permalink structure?
Forum: Plugins
In reply to: [FG Joomla to WordPress] Category relationships not migratingWait a minute. I just ran the migration tool again and it worked! How strange. I did the exact same thing. Maybe it just timed out before. Well, thanks for the support and the great plugin. Will send PayPal when the site launches.
Forum: Plugins
In reply to: [FG Joomla to WordPress] Category relationships not migratingThe Joomla sections and categories are being migrated. But the new WordPress posts are not being assigned to any of those categories.
I don’t have any other categories in wp_terms. I did not get any error messages during the migration.
Forum: Plugins
In reply to: [FG Joomla to WordPress] Category relationships not migratingI did click “Empty WordPress Content” before migrating.
I don’t have a Joomla section or category called “Uncategorized.”
When I look in the wp_term_relationships table every post is assigned to term #1, the default “uncategorized” category that WordPress uses.
There are many ways to get the link of a category, depending on whether you’re in the Loop or not. It sounds like in your case you want to do this:
<?php //get ID of current child category, this only works when is_category() is true (you're on a category page) $current = get_query_var('cat'); //get all the data for the current category $cat = get_category($current); $parent = $cat->category_parent; ?>Then wrap your image in a link:
<a href="echo get_category_link( $parent)"><img src="<?php echo ($screen); ?>" /></a>Try these pages for documentation depending on how you’re trying to reference the category ID:
http://codex.ww.wp.xz.cn/Function_Reference/get_category_parents
http://codex.ww.wp.xz.cn/Function_Reference/get_the_categoryForum: Plugins
In reply to: [CSV Importer] [Plugin: CSV Importer] Custom Taxonomies Import not workingA super easy way to get around the hierarchical taxonomy issue when importing is to simply register your taxonomies as non-hierarchical, then import your CSV, then in your code for registering your taxonomies, add the ‘hierarchical’ => true parameter back in.
Forum: Alpha/Beta/RC
In reply to: Custom post types: archive-{posttype}.php not being recognizedOh wow.
taxonomy-ps_product.php did the trick.
Then what is the point of even having archive-{posttype.php}?
Forum: Alpha/Beta/RC
In reply to: Custom post types: archive-{posttype}.php not being recognizedOK, I got /products working fine. Here is the dev site:
http://semler.joobble.com/products
I guess then what isn’t working are any sub-category archives and and nav menu items based on the custom taxonomy.
From the main navigation, click Products or any one of the drop-downs (Aviation, Fluid Handling, Liquid Purification). These are all Product Category-type menu items. These should all have the same grid-type layout as /products. But instead they are reverting to the archive.php layout.
Do I need to create separate archive-ps_product-{category}.php files for each of my categories? If so this is no big deal, but I thought the point of creating a custom template file was so that WP would use it for ALL archives of that custom post type/taxonomy.
Forum: Alpha/Beta/RC
In reply to: Custom post types: archive-{posttype}.php not being recognizedI activated the default theme, copied the above code to functions.php, and copied my archive-ps_products.php into the theme folder. Then I deactivated all plugins.
Still no success.
Forum: Themes and Templates
In reply to: custom post type archive-{posttype}.php wont loadThis only works in WordPress 3.1, but I have downloaded 3.1 and it’s still not working for me. Anyone else?
Forum: Fixing WordPress
In reply to: add_filter to the_title only in wp_nav_menuHA! I figured it out. Here it is in pastebin:
Forum: Fixing WordPress
In reply to: wp_nav_menu add a parent classSuper-easy with jQuery:
jQuery(document).ready(function($) {
$(“ul.sub-menu”).parents().addClass(‘parent’);
}This will get you something like:
<li class=”page-item”>Item 1
<li class=”page-item parent”>Item 2
<ul class=”sub-menu”>2nd level menuThe reason this works is because WP automatically appends the sub-menu class to the 2nd level menus. Really, it should apply the “parent” class to the top-level menu items that have children automatically, too. Hmm, maybe a fix should be suggested to the WP developers?
Forum: Plugins
In reply to: Adding a checkbox to custom write panelsMultiple checkboxes are tricky. I remember getting it to work once doing something like this:
if ($meta_box[‘type’] == “multicheck”){
$boxes = array(“value1”, “value2”, “value3”);
//you could also store the options as an array in when you are setting up each custom field and then pull them in hereforeach ($boxes as $box) {
echo ‘<label>’;
echo ‘<input type=”checkbox” name=”‘. $meta_box[“name”].'[]” id=”‘.$meta_box[“name”].$box.'” value=”‘.$box.'”‘;
if ($meta_box_value <> “” ) {if ( in_array($box, $meta_box_value)) { echo ‘ checked=”checked”‘; }} echo ‘/>’;
echo $day;
echo ‘</label>’;
}
//endforeach
}Forum: Plugins
In reply to: [Plugin: NextGEN Gallery] Pixelated ImageI just had the same problem. Try deactivating and deleting the plugin files and re-installing. Worked for me. (Make sure to backup your NextGEN database tables before you do this!)