Harryson
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: How to make your own catalog?What difference does it have? 20x items per group 6x groups.
Forum: Fixing WordPress
In reply to: How to make your own catalog?No, I think my clients would not like that. Kind of loses the point of the CMS.
I would normally create my own DB and back and front UI, however as I dont know anything about WP, then creating everything from ground up is too much legwork. I’m 100% sure WP has something in its api, that can be made into a simple catalog.
Forum: Fixing WordPress
In reply to: How to add custom post type archive slug to nav menu?Based on the answer I got from: http://wordpress.stackexchange.com/questions/35593/how-to-add-custom-post-type-archive-page-links-to-nav-menu
I forked that function to be more dynamic:
add_filter('wp_list_pages', 'new_nav_menu_items'); add_filter('wp_nav_menu_items', 'new_nav_menu_items'); function new_nav_menu_items($items) { global $wp_query; $class = 'menu-item menu-item-type-post_type menu-item-object-page'; foreach ($GLOBALS['posttypelinks'] as $link) { $items .= '<li class="' . $classes . ' ' . (isset($wp_query->query_vars['post_type']) && $wp_query->query_vars['post_type'] == $link['post_type'] ? 'current_page_item' : '') . '"><a href="' . site_url() . '/' . $link['slug'] . '">' . $link['title'] . '</a></li>'; } return $items; }So, I could add my post-types to menu like this (inside
create_post_type()):$GLOBALS['posttypelinks'][] = array( 'title' => $title, 'post_type' => $post_type, 'slug' => $slug );These variables are the same, that are being used inside
register_post_type()‘s array. Probably could be better solution and maybe in the form of a plugin..however, it does the trick perfectly.Forum: Fixing WordPress
In reply to: How to add custom post type archive slug to nav menu?Maybe it is possible by overriding everything and adding the menu links to the nav manually? And also detecting the active link with
$_GET.Forum: Fixing WordPress
In reply to: How to add custom post type archive slug to nav menu?Up, still cant figure this out.
Forum: Fixing WordPress
In reply to: How to add custom post type archive slug to nav menu?Ok found the plugin Custom Post Type Archives in Nav Menus, however it just adds a custom link and doesn’t really help anything..
Forum: Fixing WordPress
In reply to: How to get the lists of categories used in custom post type?Ok ok, I see. I have one last question.
How do I make it so, if I have custom post type like news. How do I view the category now? So the normal url is example.com/news/ and the categories should be example.com/news/category/films. I thought it should be as easy as THEME_DIR/category-POSTTYPENAME.php. But it doesn’t work..
I’m also facing the same problem with pagination example.com/page/PAGENR etc.. Can’t I simply use .htaccess somehow?
Forum: Fixing WordPress
In reply to: How to get the lists of categories used in custom post type?However, doesn’t that mean, that my custom taxonomy will be shown next to the normal category one? I mean, that if I’m using custom post-type, then I would wish that there is only my category (custom) and not the standard one, right next to it.
And also, wouldn’t the slugs of post-type “news” and custom taxonomy “news” get into a conflict?
Forum: Fixing WordPress
In reply to: How to get the lists of categories used in custom post type?Ahaa. I see. That was my next question, how will I get the category links correct. So meaning, that if I use custom post-type such with the slug “news”, and then make custom taxonomy for that “news system”, then I can use the categories and tags links like “example.com/news/categories/films” easier, then with the standard post taxonomies?!
Forum: Fixing WordPress
In reply to: How to get the lists of categories used in custom post type?Not sure, what would be the perks of using custom taxonomies? Currently for the “news system” I only needs categories and tags.
Forum: Fixing WordPress
In reply to: How to get the lists of categories used in custom post type?Checking out http://codex.wordpress.org/Template_Tags/wp_list_categories I cannot figure out how to make it return raw array and not formatted lists or anchors with
<br />at the end.Forum: Fixing WordPress
In reply to: How to get the lists of categories used in custom post type?Scratch that, my bad. Didn’t have any posts hooked to those categories. Problem solved, thanks 🙂
However, how do I get tags and the quantity they are being used to generate the tag cloud?
Also, I’m using these categories and tags on a custom post-type => “News”. So my post-type slug is news: How can I make the categories and tags lists to link to example.com/news/category/CATNAME and example.com/news/tags/TAGNAME
Forum: Fixing WordPress
In reply to: How to get the lists of categories used in custom post type?Thank you for replying, however that code doesn’t seem to work 🙁
I tried debugging it with
print_r():
$post_type_ids =Array ( [0] => 176 )
$post_type_cats =Array ( )I’m not familiar with wordpress code at all, so I have no idea where to go from here.
Forum: Everything else WordPress
In reply to: Permalinks and custom page template questionOk figured it out. The problem was in my post-type registration:
add_action( 'init', 'create_post_type' ); function create_post_type() { register_post_type( 'news_view', array( 'labels' => array( 'name' => __( 'News' ), 'singular_name' => __( 'News' ) ), 'public' => true, 'has_archive' => true, 'rewrite' => array('slug' => 'news'), 'supports' => array('title', 'author', 'thumbnail', 'excerpt'), 'show_in_menu' => true ) ); }The
register_post_type( 'news_view',part to be precise. As my templates where single-news.php etc.. Then the template must be single-news_view.php or my register must be news.So it is fixed now, thanks for your help, learning about post-types is a MUST in wordpress 🙂
Forum: Everything else WordPress
In reply to: Permalinks and custom page template questionSo as far as I understand, everything should be working now.
From a blank wordpress:
1. Install and very basic theme setup
2. Create the single and archive templates
3. Register the custom post type
4. Put some sample data to your new post type
..done, correct?Though, it does generate a list in archives-view and displays the contents in single-view. But it does that using index.php and not their representative templates.
Done all that, but its not working. Also, the link doesn’t appear in the menu (and also, technically should be active, but next to the custom page not appearing, that’s a very small priority.)
To be honest, I’m completely stuck. Had my hopes up, as I need to create sort of “catalog features” for some other pages and custom post types seems perfect for the job.
So how to debug this? Is there some basic step I’m missing out, since I’m not familiar with wordpress at all and basically am rushing to meat the deadline of the project. Maybe some functions.php setup function/variable? ..or maybe some setting in the admin panel -to allow custom posts type templates?
0:30 in Estonia, so I’ll report back in ~10 hours. Thanks for taking time to help me, appreciated. Good night 🙂