Hello, very interested in the question, did not find similar here. Is it possible to organize a product catalog on Wordpress without the use of plug-ins? I have my own template, but I don’t know how to rewrite styles for a plugin, and I don’t want to bother with it. I rummaged a ton of articles, plug-ins are used everywhere by people, is it really impossible to display several products on a page, and when you click, for example, on the "more" button, would the template page open for this record?
- Can. Only it will not be a product catalog in the full sense of the term, but a regular business card site with articles, each of which will be a product page. - Dmitry Gvozd
- This is normal, I just need this, without searching, filters and other things. - Webear
- Well, just make simple pages with goods and then some kind of nameplate with links to these pages in the form of a catalog and everything — Dmitry Gvozd
- So the problem is that it is not completely clear how to implement this through the admin panel, which cycle to register, so that the posts in the directory are displayed in 2 columns, and each button opens in a new window? - Webear
- Well, if there are a thousand products there, then such an approach is not very certainly, and if ten and no longer exists, then this is the easiest option - Jonny Manowar
2 answers
Most likely you will still need the standard type of records, therefore:
- You need to register a new record type, I'm talking about CPT (Custom Post Types)
- Create a page template for displaying all products (if needed).
- Create a template to display the record.
- Maybe you still need a few registered Taxonomy, to display categories and tags.
Well, then at your discretion. Successes!
CPT Registration Example
add_action( 'init', 'codex_book_init' ); /** * Register a book post type. * * @link http://codex.wordpress.org/Function_Reference/register_post_type */ function codex_book_init() { $labels = array( 'name' => _x( 'Books', 'post type general name', 'your-plugin-textdomain' ), 'singular_name' => _x( 'Book', 'post type singular name', 'your-plugin-textdomain' ), 'menu_name' => _x( 'Books', 'admin menu', 'your-plugin-textdomain' ), 'name_admin_bar' => _x( 'Book', 'add new on admin bar', 'your-plugin-textdomain' ), 'add_new' => _x( 'Add New', 'book', 'your-plugin-textdomain' ), 'add_new_item' => __( 'Add New Book', 'your-plugin-textdomain' ), 'new_item' => __( 'New Book', 'your-plugin-textdomain' ), 'edit_item' => __( 'Edit Book', 'your-plugin-textdomain' ), 'view_item' => __( 'View Book', 'your-plugin-textdomain' ), 'all_items' => __( 'All Books', 'your-plugin-textdomain' ), 'search_items' => __( 'Search Books', 'your-plugin-textdomain' ), 'parent_item_colon' => __( 'Parent Books:', 'your-plugin-textdomain' ), 'not_found' => __( 'No books found.', 'your-plugin-textdomain' ), 'not_found_in_trash' => __( 'No books found in Trash.', 'your-plugin-textdomain' ) ); $args = array( 'labels' => $labels, 'description' => __( 'Description.', 'your-plugin-textdomain' ), 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'show_in_menu' => true, 'query_var' => true, 'rewrite' => array( 'slug' => 'book' ), 'capability_type' => 'post', 'has_archive' => true, 'hierarchical' => false, 'menu_position' => null, 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' ) ); register_post_type( 'book', $args ); } - oneNo plug-ins can be, but then you need to understand and spend a little more time. You can do it with a minimum number of plug-ins, which may be more correct, but you should not do everything on the plug-ins completely because there will be a large load on the site. And you will not find a solution for yourself. Therefore, use the minimum set and the most necessary. - eugene_v
You can create pages with products, each product as a separate page, and they will be child pages in relation to the page with a list of products for which you will need to create a separate template and then simply output from the cycle. This is how you can get child pages for example:
$pages = get_pages(array( 'parent' => get_the_ID(), 'sort_order' => 'asc', 'sort_column' => 'menu_order', )); You can even add additional fields for the product pages in the admin area, then it’s convenient to display them like <?=$pages[$i]->weight;?> . Well, for the product pages themselves, you can create a separate template and also display additional fields.
- It is possible, but the solution is original. If you disassemble any of the plugins that allows you to implement a store or directory, then none of them use this approach. If not right - poke a finger. For general development does not hurt - eugene_v Nov.