lopinsjk
Forum Replies Created
-
Forum: Plugins
In reply to: [Meta Box] wysiwyg/rich text editor and wordpress galleryI solve it like so:
echo do_shortcode(rwmb_meta( '_prefix_wysiwyg' ));
Are there other solutions?
Forum: Fixing WordPress
In reply to: Insert category of taxonomy between custom post type and postGood work guys ??
Forum: Fixing WordPress
In reply to: Insert category of taxonomy between custom post type and postGood ??
Forum: Fixing WordPress
In reply to: Insert category of taxonomy between custom post type and post@robert3d what is your problem?
Forum: Fixing WordPress
In reply to: Insert category of taxonomy between custom post type and postFirst you need to create a menu with your categories. After you need to create a file
taxonomy-brand.php
:<?php get_header(); ?> <?php if ( have_posts() ) : ?> <?php while ( have_posts() ) : the_post(); ?> <a href="<?php the_permalink() ?>"> <?php the_title( '<h1>', '</h1>' ); ?> </a> <?php the_content(); ?> <?php endwhile; ?> <?php endif; ?> <?php //get_sidebar(); ?> <?php get_footer(); ?>
This loop shows the products by brand.
Now create another file named
single-prodotto.php
like this:<?php get_header(); ?> <?php if ( have_posts() ) : ?> <?php while ( have_posts() ) : the_post(); ?> <?php the_title(); the_content(); ?> <?php endwhile; ?> <?php endif; ?> <?php get_footer(); ?>
This loop shows single product. So you don’t need to use WP_Query.
Forum: Reviews
In reply to: [User Role Editor] Great Plugin – Especially when using sister pluginI have resolved it without plugin. Thank you.
Forum: Reviews
In reply to: [User Role Editor] Great Plugin – Especially when using sister pluginThank you for your answer but I want to set permission so a Editor can only edit one page.
Forum: Reviews
In reply to: [User Role Editor] Great Plugin – Especially when using sister pluginIs it work with Custom Post Type? How did you do to assign each editor to their own page?
Forum: Fixing WordPress
In reply to: Insert category of taxonomy between custom post type and postSolve it!
/*Creo il custom post type Prodotti*/ function my_custom_post_product() { $labels = array( 'name' => _x( 'Prodotti', 'post type general name' ), 'singular_name' => _x( 'Prodotto', 'post type singular name' ), 'add_new' => _x( 'Aggiungi Nuovo', 'book' ), 'add_new_item' => __( 'Aggiungi Nuovo Prodotto' ), 'edit_item' => __( 'Modifica Prodotto' ), 'new_item' => __( 'Nuovo Prodotto' ), 'all_items' => __( 'Tutti i Prodotti' ), 'view_item' => __( 'Vedi Prodotto' ), 'search_items' => __( 'Cerca Prodotti' ), 'not_found' => __( 'Nessun Prodotto Trovato' ), 'not_found_in_trash' => __( 'Nessun Prodotto Trovato nel Cestino' ), 'parent_item_colon' => '', 'menu_name' => 'Prodotti' ); $args = array( 'labels' => $labels, 'description' => 'Inserisci un nuovo prodotto', 'public' => true, 'menu_position' => 5, 'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments' ), 'has_archive' => true, 'hierarchical' => true, 'rewrite' => array('slug' => 'prodotto/%brand%','with_front' => false), 'query_var' => true, //'rewrite' => true, //'publicly_queryable' => false, ); register_post_type( 'prodotto', $args ); } add_action( 'init', 'my_custom_post_product' );
/*Creo la custom taxonomy Brand associata a Prodotti*/ function my_taxonomies_product() { $labels = array( 'name' => _x( 'Brand', 'taxonomy general name' ), 'singular_name' => _x( 'Brand', 'taxonomy singular name' ), 'search_items' => __( 'Search Product Categories' ), 'all_items' => __( 'All Product Categories' ), 'parent_item' => __( 'Parent Product Category' ), 'parent_item_colon' => __( 'Parent Product Category:' ), 'edit_item' => __( 'Edit Product Category' ), 'update_item' => __( 'Update Product Category' ), 'add_new_item' => __( 'Add New Product Category' ), 'new_item_name' => __( 'New Product Category' ), 'menu_name' => __( 'Brand' ), ); $args = array( 'labels' => $labels, 'hierarchical' => true, 'public' => true, 'query_var' => 'brand', //slug prodotto deve coincidere con il primo parametro dello slug del Custom Post Type correlato 'rewrite' => array('slug' => 'prodotto' ), '_builtin' => false, ); register_taxonomy( 'brand', 'prodotto', $args ); } add_action( 'init', 'my_taxonomies_product', 0 );
/*Filtro per modificare il permalink*/ add_filter('post_link', 'brand_permalink', 1, 3); add_filter('post_type_link', 'brand_permalink', 1, 3); function brand_permalink($permalink, $post_id, $leavename) { //con %brand% catturo il rewrite del Custom Post Type if (strpos($permalink, '%brand%') === FALSE) return $permalink; // Get post $post = get_post($post_id); if (!$post) return $permalink; // Get taxonomy terms $terms = wp_get_object_terms($post->ID, 'brand'); if (!is_wp_error($terms) && !empty($terms) && is_object($terms[0])) $taxonomy_slug = $terms[0]->slug; else $taxonomy_slug = 'no-brand'; return str_replace('%brand%', $taxonomy_slug, $permalink); }
now create 2 categories inside brand:
nike and adidas;
create two products:
t-shirt with nike category;
sneaker with adidas category.Now check the permalink inside nike/adidas category page and inside t-shirt/snaker products.
Is it all right?