C:\xampp\htdocs\landing\wp-content\plugins\penci-pennews-portfolio\penci-pennew-portfolio.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<?php
/*
Plugin Name: Penci Pennews Portfolio
Plugin URI: http://pencidesign.com/
Description: Portfolio Plugin for PenNews theme.
Version: 2.3
Author: PenciDesign
Author URI: http://themeforest.net/user/pencidesign?ref=pencidesign
*/

// Exit if accessed directly
if ( ! defined'ABSPATH' ) ) {
    exit;
}

define'PENCI_PORTFOLIO__DIR'plugin_dir_path__FILE__ ) );
define'PENCI_PORTFOLIO__URL'plugin_dir_url__FILE__ ) );

if ( ! 
class_exists'Penci_Portfolio' ) ):
    class 
Penci_Portfolio {
        private static 
$instance;

        public static function 
get_instance() {
            if ( 
null == self::$instance ) {
                
self::$instance = new Penci_Portfolio();
            }
            return 
self::$instance;
        }

        
/**
         * Initializes the plugin by setting filters and administration functions.
         */
        
private function __construct() {
            
$this->load_files();

            
add_action'plugins_loaded', array( $this'load_text_domain' ) );
            
add_action'init', array( $this'register_portfolio_post_type' ) );
            
add_action'init', array( $this'register_portfolio_category' ) );
            
add_filter'single_template', array( $this'register_portfolio_single' ) );
            
add_filter'template_include', array( $this'register_portfolio_categories' ) );
            
add_action'pre_get_posts', array( $this'portfolio_custom_posts_per_page' ) );
        }

        public function 
load_files() {
            include_once( 
'inc/portfolio.php' );
            include_once( 
'inc/shortcode-vc.php' );
            include_once( 
'inc/helper.php' );
            include_once( 
'inc/metabox.php' );
        }


        public function 
load_text_domain() {
            
load_plugin_textdomain'pencidesign'falsePENCI_PORTFOLIO__DIR '/languages/' );
        }

        public function 
register_portfolio_post_type() {
            
$labels = array(
                
'name' => _x'Portfolio''post type general name''pencidesign' ),
                
'singular_name' => _x'Portfolio''post type singular name''pencidesign' ),
                
'add_new' => __'Add New''pencidesign' ),
                
'add_new_item' => __'Add New Project''pencidesign' ),
                
'edit_item' => __'Edit Project''pencidesign' ),
                
'new_item' => __'New Project''pencidesign' ),
                
'all_items' => __'All Projects''pencidesign' ),
                
'view_item' => __'View Portfolio''pencidesign' ),
                
'search_items' => __'Search Portfolio''pencidesign' ),
                
'not_found' => __'No projects found''pencidesign' ),
                
'not_found_in_trash' => __'No projects found in Trash''pencidesign' ),
                
'parent_item_colon' => '',
                
'menu_name' => _x'Portfolio''post type general name''pencidesign' ),
            );

            
$slug get_theme_mod'penci_pfl_custom_catslug' ) ? get_theme_mod'penci_pfl_custom_catslug' ) : 'portfolio';

            
$args = array(
                
'labels'             => $labels,
                
'public'             => true,
                
'publicly_queryable' => true,
                
'show_ui'            => true,
                
'show_in_menu'       => true,
                
'show_in_rest'       => true,
                
'query_var'          => Pennew_Portfolio_Helper::get_slug(),
                
'rewrite'            => array(
                    
'slug'       => Pennew_Portfolio_Helper::get_slug(),
                    
'with_front' => true,
                    
'feeds'      => true,
                    
'pages'      => true,
                ),
                
'capability_type'    => 'page',
                
'map_meta_cap'       => true,
                
'has_archive'        => true,
                
'hierarchical'       => false,
                
'menu_position'      => null,
                
'menu_icon'          => 'dashicons-portfolio',
                
'supports'           => array( 'title''editor''author''thumbnail''comments' )

            );

            
register_post_type'portfolio'$args );

        }

        
/**
         * Register Portfolio Categories
         */
        
public function register_portfolio_category() {

            
$labels = array(
                
'name' => _x'Portfolio Categories''taxonomy general name''pencidesign' ),
                
'singular_name' => _x'Portfolio Category''taxonomy singular name''pencidesign' ),
                
'search_items' => __'Search Portfolio Categories''pencidesign' ),
                
'all_items' => __'All Portfolio Categories''pencidesign' ),
                
'parent_item' => __'Parent Portfolio Category''pencidesign' ),
                
'parent_item_colon' => __'Parent Portfolio Category:''pencidesign' ),
                
'edit_item' => __'Edit Portfolio Category''pencidesign' ),
                
'update_item' => __'Update Portfolio Category''pencidesign' ),
                
'add_new_item' => __'Add New Portfolio Category''pencidesign' ),
                
'new_item_name' => __'New Portfolio Category Name''pencidesign' ),
                
'menu_name' => __'Portfolio Category''pencidesign' )
            );


            
$args = array(
                
'hierarchical' => true,
                
'labels' => $labels,
                
'show_ui' => true,
                
'show_admin_column' => true,
                
'query_var' => true,
                
'rewrite' => array( 'slug' => Pennew_Portfolio_Helper::get_slug_tax() )
            );

            
register_taxonomy'portfolio-category', array( 'portfolio' ), $args );
        }


        
/**
         * Register single portfolio template
         */
        
public function register_portfolio_single$single_template ) {
            global 
$post;

            if ( 
$post->post_type == 'portfolio' ) {
                
$single_template dirname__FILE__ ) . '/inc/single-portfolio.php';
            }

            return 
$single_template;
        }


        
/**
         *   Register categories portfolio template
         */
        
public function register_portfolio_categories$template ) {

            if( 
is_post_type_archive('portfolio') ) {
                
$template dirname__FILE__ ) . '/inc/taxonomy-portfolio.php';
            }

            if ( 
is_tax'portfolio-category' ) ) {
                
$template dirname__FILE__ ) . '/inc/taxonomy-portfolio-category.php';
            }
            return 
$template;
        }


        
/**
         * Custom posts per page portfolio categories listing
         */

        
public function portfolio_custom_posts_per_page$query ) {
            if ( ! 
is_admin() && $query->is_main_query() && $query->is_post_type_archive'portfolio' ) ) {
                
$numpost get_theme_mod'penci_portfolio_cat_showposts' );
                
$numpost $numpost $numpost 12;

                
$query->set'posts_per_page'$numpost );
            }
        }
    }

    
add_action'plugins_loaded', array( 'Penci_Portfolio''get_instance' ) );
endif; 
/* End check if class exists */
x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586