Pytheas – narzucona kategoria portfolio
-
Witam 🙂
Korzystam z ów motywu > https://justfreethemes.com/pytheas-free-wordpress-theme/
Mam problem jednak ponieważ sam moduł/skrypt portfolio mi się podoba jednak przy tworzeniu w nim artykułu narzuca w adresie swoją kategorię czyli http://www.mojastrona/portfolio/nazwaarta.
Chciałbym żeby tak zmienić to w kodzie aby nie było tego portfolio tylko po prostu http://www.mojastrona/nazwaarta.
Poniżej taxonomy-portfolio_category.php
<?php /** * The template for displaying Portfolio Categories * * Learn more: http://codex.wordpress.org/Template_Hierarchy * * @package Pytheas WordPress Theme * @author Alexander Clarke * @copyright Copyright (c) 2015, WPExplorer.com * @link http://www.wpexplorer.com * @since 1.0.0 */ get_header(); ?> <header class="page-header clr"> <h1 class="page-header-title"><?php echo single_term_title(); ? ></h1> <?php if ( category_description() ) : ?> <div class="archive-meta"><?php echo term_description(); ? ></div> <?php endif; ?> <?php if ( wpex_get_option( 'portfolio_archive_filter', '1' ) ) : ?> <?php $posttype_obj = get_post_type_object( 'portfolio' ); ?> <?php $portfolio_terms = get_terms( 'portfolio_category', array( 'orderby' => 'koncert', 'order' => 'ASC' ) ); ?> <?php if ( $portfolio_terms ) : ?> <ul class="tax-archives-filter dropdown-menu clr"> <li class="browse"><a href="#" title="<?php _e( 'Browse', 'pytheas' ); ?>"><?php _e( 'Browse', 'pytheas' ); ?> <?php echo $posttype_obj->label; ?><i class="fa fa-caret-down"></i></a> <ul> <li><a href="<?php echo get_post_type_archive_link( 'koncert' ); ?>" title="<?php echo $posttype_obj- >label; ?>" class="active"><?php _e( 'All', 'pytheas' ); ?></a></li> <?php foreach( $portfolio_terms as $portfolio_term ) : ?> <li><a href="<?php echo esc_url( get_term_link( $portfolio_term->slug, 'portfolio_category' ) ); ?>" title="<?php echo esc_attr( $portfolio_term->name ); ?>"><?php echo esc_html( $portfolio_term->name ); ?></a></li> <?php endforeach; ?> </ul> </li> </ul><!-- .tax-archives-filter --> <?php endif; ?> <?php endif; ?> </header><!-- .page-heading --> <?php if ( have_posts( ) ) : ?> <div id="primary" class="content-area span_24 row clr"> <div id="content" class="site-content" role="main"> <div class="portfolio-content row clr"> <?php $wpex_count=0; while ( have_posts() ) : the_post(); $wpex_count++; get_template_part( 'content', 'portfolio' ); if ( $wpex_count == 4 ) { echo '<div class="clr"></div>'; $wpex_count=0; } endwhile; ?> </div><!-- .portfolio-content --> <?php wpex_pagination(); ?> </div><!-- #content --> </div><!-- #primary --> <?php endif; ?> <?php get_footer(); ?>
oraz portfolio.php
<?php if ( ! class_exists( 'Symple_Portfolio_Post_Type' ) ) : class Symple_Portfolio_Post_Type { public function __construct() { // Adds the portfolio post type and taxonomies add_action( 'init', array( &$this, 'portfolio_init' ), 0 ); // Thumbnail support for portfolio posts add_theme_support( 'post-thumbnails', array( 'portfolio' ) ); // Adds columns in the admin view for thumbnail and taxonomies add_filter( 'manage_edit-portfolio_columns', array( &$this, 'portfolio_edit_columns' ) ); add_action( 'manage_portfolio_posts_custom_column', array( &$this, 'portfolio_column_display' ), 10, 2 ); // Allows filtering of posts by taxonomy in the admin view add_action( 'restrict_manage_posts', array( &$this, 'portfolio_add_taxonomy_filters' ) ); } public function portfolio_init() { $labels = array( 'name' => __( 'Portfolio', 'pytheas' ), 'singular_name' => __( 'Portfolio Item', 'pytheas' ), 'add_new' => __( 'Add New Item', 'pytheas' ), 'add_new_item' => __( 'Add New Portfolio Item', 'pytheas' ), 'edit_item' => __( 'Edit Portfolio Item', 'pytheas' ), 'new_item' => __( 'Add New Portfolio Item', 'pytheas' ), 'view_item' => __( 'View Item', 'pytheas' ), 'search_items' => __( 'Search Portfolio', 'pytheas' ), 'not_found' => __( 'No portfolio items found', 'pytheas' ), 'not_found_in_trash' => __( 'No portfolio items found in trash', 'pytheas' ) ); $args = array( 'labels' => $labels, 'public' => true, 'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', 'comments', 'custom-fields', 'revisions', 'post-formats' ), 'capability_type' => 'post', 'rewrite' => array( "slug" => "portfolio" ), // Permalinks format 'has_archive' => true, 'menu_icon' => 'dashicons-portfolio', ); $args = apply_filters('symple_portfolio_args', $args); register_post_type( 'portfolio', $args ); $taxonomy_portfolio_tag_labels = array( 'name' => __( 'Portfolio Tags', 'pytheas' ), 'singular_name' => __( 'Portfolio Tag', 'pytheas' ), 'search_items' => __( 'Search Portfolio Tags', 'pytheas' ), 'popular_items' => __( 'Popular Portfolio Tags', 'pytheas' ), 'all_items' => __( 'All Portfolio Tags', 'pytheas' ), 'parent_item' => __( 'Parent Portfolio Tag', 'pytheas' ), 'parent_item_colon' => __( 'Parent Portfolio Tag:', 'pytheas' ), 'edit_item' => __( 'Edit Portfolio Tag', 'pytheas' ), 'update_item' => __( 'Update Portfolio Tag', 'pytheas' ), 'add_new_item' => __( 'Add New Portfolio Tag', 'pytheas' ), 'new_item_name' => __( 'New Portfolio Tag Name', 'pytheas' ), 'separate_items_with_commas' => __( 'Separate portfolio tags with commas', 'pytheas' ), 'add_or_remove_items' => __( 'Add or remove portfolio tags', 'pytheas' ), 'choose_from_most_used' => __( 'Choose from the most used portfolio tags', 'pytheas' ), 'menu_name' => __( 'Portfolio Tags', 'pytheas' ) ); $taxonomy_portfolio_tag_args = array( 'labels' => $taxonomy_portfolio_tag_labels, 'public' => true, 'show_in_nav_menus' => true, 'show_ui' => true, 'show_tagcloud' => true, 'hierarchical' => false, 'rewrite' => array( 'slug' => 'portfolio-tag' ), 'query_var' => true ); $taxonomy_portfolio_tag_args = apply_filters('symple_taxonomy_portfolio_tag_args', $taxonomy_portfolio_tag_args); register_taxonomy( 'portfolio_tag', array( 'portfolio' ), $taxonomy_portfolio_tag_args ); $taxonomy_portfolio_category_labels = array( 'name' => __( 'Portfolio Categories', 'pytheas' ), 'singular_name' > __( 'Portfolio Category', 'pytheas' ), 'search_items' => __( 'Search Portfolio Categories', 'pytheas' ), 'popular_items' => __( 'Popular Portfolio Categories', 'pytheas' ), 'all_items' => __( 'All Portfolio Categories', 'pytheas' ), 'parent_item' => __( 'Parent Portfolio Category', 'pytheas' ), 'parent_item_colon' => __( 'Parent Portfolio Category:', 'pytheas' ), 'edit_item' => __( 'Edit Portfolio Category', 'pytheas' ), 'update_item' => __( 'Update Portfolio Category', 'pytheas' ), 'add_new_item' => __( 'Add New Portfolio Category', 'pytheas' ), 'new_item_name' => __( 'New Portfolio Category Name', 'pytheas' ), 'separate_items_with_commas' => __( 'Separate portfolio categories with commas', 'pytheas' ), 'add_or_remove_items' => __( 'Add or remove portfolio categories', 'pytheas' ), 'choose_from_most_used' => __( 'Choose from the most used portfolio categories', 'pytheas' ), 'menu_name' => __( 'Portfolio Categories', 'pytheas' ), ); $taxonomy_portfolio_category_args = array( 'labels' => $taxonomy_portfolio_category_labels, 'public' => true, 'show_in_nav_menus' => true, 'show_ui' => true, 'show_tagcloud' => true, 'hierarchical' => true, 'rewrite' => array( 'slug' => 'portfolio-category' ), 'query_var' => true, ); $taxonomy_portfolio_category_args = apply_filters('symple_taxonomy_portfolio_category_args', $taxonomy_portfolio_category_args); register_taxonomy( 'portfolio_category', array( 'portfolio' ), $taxonomy_portfolio_category_args ); } public function portfolio_edit_columns( $columns ) { $columns['portfolio_category'] = __( 'Category', 'pytheas' ); $columns['portfolio_tag'] = __( 'Tags', 'pytheas' ); return $columns; } public function portfolio_column_display( $column, $post_id ) { // Code from: http://wpengineer.com/display-post-thumbnail-post-page-overview switch ( $column ) { // Display the thumbnail in the column view case "portfolio_thumbnail": $width = (int) 80; $height = (int) 80; $thumbnail_id = get_post_meta( $post_id, '_thumbnail_id', true ); // Display the featured image in the column view if possible if ( $thumbnail_id ) { $thumb = wp_get_attachment_image( $thumbnail_id, array($width, $height), true ); } if ( isset( $thumb ) ) { echo $thumb; } else { echo __('None', 'pytheas'); } break; // Display the portfolio tags in the column view case "portfolio_category": if ( $category_list = get_the_term_list( $post_id, 'portfolio_category', '', ', ', '' ) ) { echo $category_list; } else { echo __('None', 'pytheas'); } break; // Display the portfolio tags in the column view case "portfolio_tag": if ( $tag_list = get_the_term_list( $post_id, 'portfolio_tag', '', ', ', '' ) ) { echo $tag_list; } else { echo __('None', 'pytheas'); } break; } } public function portfolio_add_taxonomy_filters() { global $typenow; // An array of all the taxonomyies you want to display. Use the taxonomy name or slug $taxonomies = array( 'portfolio_category', 'portfolio_tag' ); // must set this to the post type you want the filter(s) displayed on if ( $typenow == 'portfolio' ) { foreach ( $taxonomies as $tax_slug ) { $current_tax_slug = isset( $_GET[$tax_slug] ) ? $_GET[$tax_slug] : false; $tax_obj = get_taxonomy( $tax_slug ); $tax_name = $tax_obj->labels->name; $terms = get_terms($tax_slug); if ( count( $terms ) > 0) { echo "<select name='$tax_slug' id='$tax_slug' class='postform'>"; echo "<option value=''>$tax_name</option>"; foreach ( $terms as $term ) { echo '<option value=' . $term->slug, $current_tax_slug == $term->slug ? ' selected="selected"' : '','>' . $term->name .' (' . $term->count .')</option>'; } echo "</select>"; } } } } } new Symple_Portfolio_Post_Type; endif;
Dziękuję z góry za pomoc 🙂
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- Temat ‘Pytheas – narzucona kategoria portfolio’ jest zamknięty na nowe odpowiedzi.