first commit
This commit is contained in:
@@ -0,0 +1,657 @@
|
||||
<?php if ( ! defined( 'FW' ) ) {
|
||||
die( 'Forbidden' );
|
||||
}
|
||||
|
||||
class FW_Extension_Team extends FW_Extension {
|
||||
|
||||
private $post_type = 'fw-team';
|
||||
private $slug = 'member';
|
||||
private $taxonomy_slug = 'team';
|
||||
private $taxonomy_name = 'fw-team-category';
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function _init() {
|
||||
$this->define_slugs();
|
||||
|
||||
add_action( 'init', array( $this, '_action_register_post_type' ) );
|
||||
add_action( 'init', array( $this, '_action_register_taxonomy' ) );
|
||||
|
||||
if ( is_admin() ) {
|
||||
$this->save_permalink_structure();
|
||||
$this->add_admin_actions();
|
||||
$this->add_admin_filters();
|
||||
}
|
||||
}
|
||||
|
||||
private function define_slugs() {
|
||||
$this->slug = apply_filters(
|
||||
'fw_ext_team_post_slug',
|
||||
$this->get_db_data( 'permalinks/post', $this->slug )
|
||||
);
|
||||
|
||||
$this->taxonomy_slug = apply_filters(
|
||||
'fw_ext_team_taxonomy_slug',
|
||||
$this->get_db_data( 'permalinks/taxonomy', $this->taxonomy_slug )
|
||||
);
|
||||
}
|
||||
|
||||
private function add_admin_actions() {
|
||||
add_action( 'admin_init', array( $this, '_action_add_permalink_in_settings' ) );
|
||||
add_action( 'admin_menu', array( $this, '_action_admin_rename_team' ) );
|
||||
add_action( 'restrict_manage_posts', array( $this, '_action_admin_add_team_edit_page_filter' ) );
|
||||
// listing screen
|
||||
add_action( 'manage_' . $this->post_type . '_posts_custom_column',
|
||||
array(
|
||||
$this,
|
||||
'_action_admin_manage_custom_column'
|
||||
),
|
||||
10,
|
||||
2 );
|
||||
|
||||
// add / edit screen
|
||||
add_action( 'do_meta_boxes', array( $this, '_action_admin_featured_image_label' ) );
|
||||
|
||||
add_action( 'admin_enqueue_scripts', array( $this, '_action_admin_add_static' ) );
|
||||
|
||||
add_action( 'admin_head', array( $this, '_action_admin_initial_nav_menu_meta_boxes' ), 999 );
|
||||
}
|
||||
|
||||
private function save_permalink_structure() {
|
||||
|
||||
if ( ! isset( $_POST['permalink_structure'] ) && ! isset( $_POST['category_base'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$post = FW_Request::POST( 'fw_ext_team_member_slug',
|
||||
apply_filters( 'fw_ext_team_post_slug', $this->slug )
|
||||
);
|
||||
|
||||
$taxonomy = FW_Request::POST( 'fw_ext_team_team_slug',
|
||||
apply_filters( 'fw_ext_team_taxonomy_slug', $this->taxonomy_slug )
|
||||
);
|
||||
|
||||
|
||||
$this->set_db_data( 'permalinks/post', $post );
|
||||
$this->set_db_data( 'permalinks/taxonomy', $taxonomy );
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
**/
|
||||
public function _action_add_permalink_in_settings() {
|
||||
add_settings_field(
|
||||
'fw_ext_team_member_slug',
|
||||
__( 'Team member base', 'mwtemplates' ),
|
||||
array( $this, '_member_slug_input' ),
|
||||
'permalink',
|
||||
'optional'
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
'fw_ext_team_team_slug',
|
||||
__( 'Team category base', 'mwtemplates' ),
|
||||
array( $this, '_team_slug_input' ),
|
||||
'permalink',
|
||||
'optional'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function _member_slug_input() {
|
||||
?>
|
||||
<input type="text" name="fw_ext_team_member_slug" value="<?php echo $this->slug; ?>">
|
||||
<code>/my-member</code>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function _team_slug_input() {
|
||||
?>
|
||||
<input type="text" name="fw_ext_team_team_slug" value="<?php echo $this->taxonomy_slug; ?>">
|
||||
<code>/my-team</code>
|
||||
<?php
|
||||
}
|
||||
|
||||
public function add_admin_filters() {
|
||||
add_filter( 'parse_query', array( $this, '_filter_admin_filter_team_by_team_category' ), 10, 2 );
|
||||
add_filter( 'months_dropdown_results', array( $this, '_filter_admin_remove_select_by_date_filter' ) );
|
||||
add_filter( 'manage_edit-' . $this->post_type . '_columns',
|
||||
array(
|
||||
$this,
|
||||
'_filter_admin_manage_edit_columns'
|
||||
),
|
||||
10,
|
||||
1 );
|
||||
|
||||
add_filter( 'fw_post_options', array( $this, '_filter_admin_add_post_options' ), 10, 2 );
|
||||
add_filter( 'fw_taxonomy_options', array( $this, '_filter_admin_add_taxonomy_options' ), 10, 2 );
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function _action_admin_add_static() {
|
||||
$team_listing_screen = array(
|
||||
'only' => array(
|
||||
array(
|
||||
'post_type' => $this->post_type,
|
||||
'base' => array( 'edit' )
|
||||
)
|
||||
)
|
||||
);
|
||||
$team_add_edit_screen = array(
|
||||
'only' => array(
|
||||
array(
|
||||
'post_type' => $this->post_type,
|
||||
'base' => 'post'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if ( fw_current_screen_match( $team_listing_screen ) ) {
|
||||
wp_enqueue_style(
|
||||
'fw-extension-' . $this->get_name() . '-listing',
|
||||
$this->get_declared_URI( '/static/css/admin-listing.css' ),
|
||||
array(),
|
||||
fw()->manifest->get_version()
|
||||
);
|
||||
}
|
||||
|
||||
if ( fw_current_screen_match( $team_add_edit_screen ) ) {
|
||||
wp_enqueue_style(
|
||||
'fw-extension-' . $this->get_name() . '-add-edit',
|
||||
$this->get_declared_URI( '/static/css/admin-add-edit.css' ),
|
||||
array(),
|
||||
fw()->manifest->get_version()
|
||||
);
|
||||
wp_enqueue_script(
|
||||
'fw-extension-' . $this->get_name() . '-add-edit',
|
||||
$this->get_declared_URI( '/static/js/admin-add-edit.js' ),
|
||||
array( 'jquery' ),
|
||||
fw()->manifest->get_version(),
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function _action_register_post_type() {
|
||||
|
||||
$post_names = apply_filters( 'fw_ext_team_post_type_name',
|
||||
array(
|
||||
'singular' => __( 'Team member', 'mwtemplates' ),
|
||||
'plural' => __( 'Team members', 'mwtemplates' )
|
||||
) );
|
||||
|
||||
register_post_type( $this->post_type,
|
||||
array(
|
||||
'labels' => array(
|
||||
'name' => $post_names['plural'], //__( 'Team', 'mwtemplates' ),
|
||||
'singular_name' => $post_names['singular'], //__( 'Team member', 'mwtemplates' ),
|
||||
'add_new' => __( 'Add New', 'mwtemplates' ),
|
||||
'add_new_item' => sprintf( __( 'Add New %s', 'mwtemplates' ), $post_names['singular'] ),
|
||||
'edit' => __( 'Edit', 'mwtemplates' ),
|
||||
'edit_item' => sprintf( __( 'Edit %s', 'mwtemplates' ), $post_names['singular'] ),
|
||||
'new_item' => sprintf( __( 'New %s', 'mwtemplates' ), $post_names['singular'] ),
|
||||
'all_items' => sprintf( __( 'All %s', 'mwtemplates' ), $post_names['plural'] ),
|
||||
'view' => sprintf( __( 'View %s', 'mwtemplates' ), $post_names['singular'] ),
|
||||
'view_item' => sprintf( __( 'View %s', 'mwtemplates' ), $post_names['singular'] ),
|
||||
'search_items' => sprintf( __( 'Search %s', 'mwtemplates' ), $post_names['plural'] ),
|
||||
'not_found' => sprintf( __( 'No %s Found', 'mwtemplates' ), $post_names['plural'] ),
|
||||
'not_found_in_trash' => sprintf( __( 'No %s Found In Trash', 'mwtemplates' ), $post_names['plural'] ),
|
||||
'parent_item_colon' => '' /* text for parent types */
|
||||
),
|
||||
'description' => __( 'Create a team item', 'mwtemplates' ),
|
||||
'public' => true,
|
||||
'show_ui' => true,
|
||||
'show_in_menu' => true,
|
||||
'publicly_queryable' => true,
|
||||
/* queries can be performed on the front end */
|
||||
'has_archive' => true,
|
||||
'rewrite' => array(
|
||||
'slug' => $this->slug
|
||||
),
|
||||
'menu_position' => 4,
|
||||
'show_in_nav_menus' => true,
|
||||
'menu_icon' => 'dashicons-businessman',
|
||||
'hierarchical' => false,
|
||||
'query_var' => true,
|
||||
/* Sets the query_var key for this post type. Default: true - set to $post_type */
|
||||
'supports' => array(
|
||||
'title', /* Text input field to create a post title. */
|
||||
'editor',
|
||||
'thumbnail', /* Displays a box for featured image. */
|
||||
'excerpt',
|
||||
),
|
||||
'capabilities' => array(
|
||||
'edit_post' => 'edit_pages',
|
||||
'read_post' => 'edit_pages',
|
||||
'delete_post' => 'edit_pages',
|
||||
'edit_posts' => 'edit_pages',
|
||||
'edit_others_posts' => 'edit_pages',
|
||||
'publish_posts' => 'edit_pages',
|
||||
'read_private_posts' => 'edit_pages',
|
||||
'read' => 'edit_pages',
|
||||
'delete_posts' => 'edit_pages',
|
||||
'delete_private_posts' => 'edit_pages',
|
||||
'delete_published_posts' => 'edit_pages',
|
||||
'delete_others_posts' => 'edit_pages',
|
||||
'edit_private_posts' => 'edit_pages',
|
||||
'edit_published_posts' => 'edit_pages',
|
||||
),
|
||||
) );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function _action_register_taxonomy() {
|
||||
|
||||
$category_names = apply_filters( 'fw_ext_team_category_name',
|
||||
array(
|
||||
'singular' => __( 'Category', 'mwtemplates' ),
|
||||
'plural' => __( 'Categories', 'mwtemplates' )
|
||||
) );
|
||||
|
||||
$labels = array(
|
||||
'name' => sprintf( _x( 'Team %s', 'taxonomy general name', 'mwtemplates' ),
|
||||
$category_names['plural'] ),
|
||||
'singular_name' => sprintf( _x( 'Team %s', 'taxonomy singular name', 'mwtemplates' ),
|
||||
$category_names['singular'] ),
|
||||
'search_items' => sprintf( __( 'Search %s', 'mwtemplates' ), $category_names['plural'] ),
|
||||
'all_items' => sprintf( __( 'All %s', 'mwtemplates' ), $category_names['plural'] ),
|
||||
'parent_item' => sprintf( __( 'Parent %s', 'mwtemplates' ), $category_names['singular'] ),
|
||||
'parent_item_colon' => sprintf( __( 'Parent %s:', 'mwtemplates' ), $category_names['singular'] ),
|
||||
'edit_item' => sprintf( __( 'Edit %s', 'mwtemplates' ), $category_names['singular'] ),
|
||||
'update_item' => sprintf( __( 'Update %s', 'mwtemplates' ), $category_names['singular'] ),
|
||||
'add_new_item' => sprintf( __( 'Add New %s', 'mwtemplates' ), $category_names['singular'] ),
|
||||
'new_item_name' => sprintf( __( 'New %s Name', 'mwtemplates' ), $category_names['singular'] ),
|
||||
'menu_name' => sprintf( __( '%s', 'mwtemplates' ), $category_names['plural'] )
|
||||
);
|
||||
$args = array(
|
||||
'labels' => $labels,
|
||||
'public' => true,
|
||||
'hierarchical' => true,
|
||||
'show_ui' => true,
|
||||
'show_admin_column' => true,
|
||||
'query_var' => true,
|
||||
'show_in_nav_menus' => true,
|
||||
'show_tagcloud' => false,
|
||||
'rewrite' => array(
|
||||
'slug' => $this->taxonomy_slug
|
||||
),
|
||||
);
|
||||
|
||||
register_taxonomy( $this->taxonomy_name, esc_attr( $this->post_type ), $args );
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @param array $options
|
||||
* @param string $post_type
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function _filter_admin_add_post_options( $options, $post_type ) {
|
||||
//get social icon shortcode options
|
||||
$shortcodes_extension = fw()->extensions->get( 'shortcodes' );
|
||||
$member_social_icons = array();
|
||||
|
||||
if ( ! empty( $shortcodes_extension ) ) {
|
||||
|
||||
$member_list_icons = $shortcodes_extension->get_shortcode( 'icons_list' )->get_options();
|
||||
$member_social_icons = $shortcodes_extension->get_shortcode( 'icons_social' )->get_options();
|
||||
$member_skills = $shortcodes_extension->get_shortcode( 'progress_bar' )->get_options();
|
||||
$contact_form = $shortcodes_extension->get_shortcode( 'contact_form' )->get_options();
|
||||
|
||||
if ( $post_type === $this->post_type ) {
|
||||
|
||||
$options[] = array(
|
||||
'member_meta_tab' => array(
|
||||
'title' => __( 'Member Meta', 'mwtemplates' ),
|
||||
'type' => 'box',
|
||||
'options' => array(
|
||||
'tab_position' => array(
|
||||
'title' => __( 'Member position', 'mwtemplates' ),
|
||||
'type' => 'tab',
|
||||
'options' => array(
|
||||
'position' => array(
|
||||
'title' => __( 'Member position name', 'mwtemplates' ),
|
||||
'type' => 'text',
|
||||
)
|
||||
),
|
||||
),
|
||||
'tab_social_icons' => array(
|
||||
'title' => __( 'Social links', 'mwtemplates' ),
|
||||
'type' => 'tab',
|
||||
'options' => array(
|
||||
$member_social_icons,
|
||||
),
|
||||
),
|
||||
'tab_contacs' => array(
|
||||
'title' => __( 'Member Contacts', 'mwtemplates' ),
|
||||
'type' => 'tab',
|
||||
'options' => array(
|
||||
$member_list_icons,
|
||||
),
|
||||
),
|
||||
'tab_bio' => array(
|
||||
'title' => __( 'Member Bio Tab', 'mwtemplates' ),
|
||||
'type' => 'tab',
|
||||
'options' => array(
|
||||
'bio' => array(
|
||||
'type' => 'wp-editor',
|
||||
'value' => '',
|
||||
'label' => __('Member Bio', 'mwtemplates'),
|
||||
'wpautop' => true,
|
||||
'editor_type' => false, // tinymce, html
|
||||
)
|
||||
),
|
||||
),
|
||||
'tab_skills' => array(
|
||||
'title' => __( 'Skills Tab', 'mwtemplates' ),
|
||||
'type' => 'tab',
|
||||
'options' => array(
|
||||
'skills' => array(
|
||||
'type' => 'addable-box',
|
||||
'value' => '',
|
||||
'label' => esc_html__( 'Skills progress bars', 'mwtemplates' ),
|
||||
'desc' => esc_html__( 'Display skills as a progress bar', 'mwtemplates' ),
|
||||
'template' => '{{=title}}',
|
||||
'box-options' => array(
|
||||
$member_skills,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
'tab_form' => array(
|
||||
'title' => __( 'Contact Form Tab', 'mwtemplates' ),
|
||||
'type' => 'tab',
|
||||
'options' => array(
|
||||
$contact_form,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
'additional_content_box' => array(
|
||||
'title' => __( 'Below tabs content', 'mwtemplates' ),
|
||||
'type' => 'box',
|
||||
'options' => array(
|
||||
'additional_content' => array(
|
||||
'type' => 'wp-editor',
|
||||
'value' => '',
|
||||
'label' => __( 'Text below member meta tabs', 'mwtemplates' ),
|
||||
'wpautop' => true,
|
||||
'size' => 'large',
|
||||
'editor_type' => false, // tinymce, html
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @param array $options
|
||||
* @param string $post_type
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function _filter_admin_add_taxonomy_options( $options, $taxonomy_name ) {
|
||||
if ( $taxonomy_name === $this->taxonomy_name ) {
|
||||
// put here options for taxonomy
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* internal
|
||||
*/
|
||||
public function _action_admin_rename_team() {
|
||||
global $menu;
|
||||
|
||||
foreach ( $menu as $key => $menu_item ) {
|
||||
if ( $menu_item[2] == 'edit.php?post_type=' . $this->post_type ) {
|
||||
$menu[ $key ][0] = __( 'Team', 'mwtemplates' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the title of Featured Image Meta box
|
||||
* @internal
|
||||
*/
|
||||
public function _action_admin_featured_image_label() {
|
||||
remove_meta_box( 'postimagediv', $this->post_type, 'side' );
|
||||
add_meta_box(
|
||||
'postimagediv',
|
||||
__( 'Team Member Photo', 'mwtemplates' ),
|
||||
'post_thumbnail_meta_box',
|
||||
$this->post_type,
|
||||
'side'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @param string $column_name
|
||||
* @param int $id
|
||||
*/
|
||||
public function _action_admin_manage_custom_column( $column_name, $id ) {
|
||||
|
||||
switch ( $column_name ) {
|
||||
case 'image':
|
||||
if ( get_the_post_thumbnail( intval( $id ) ) ) {
|
||||
$value = '<a href="' . get_edit_post_link( $id,
|
||||
true ) . '" title="' . esc_attr( __( 'Edit this item', 'mwtemplates' ) ) . '">' .
|
||||
wp_get_attachment_image( get_post_thumbnail_id( intval( $id ) ),
|
||||
array( 150, 100 ),
|
||||
true ) .
|
||||
'</a>';
|
||||
} else {
|
||||
$value = '<img src="' . $this->get_declared_URI( '/static/images/no-image.png' ) . '"/>';
|
||||
}
|
||||
echo $value;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function _action_admin_initial_nav_menu_meta_boxes() {
|
||||
$screen = array(
|
||||
'only' => array(
|
||||
'base' => 'nav-menus'
|
||||
)
|
||||
);
|
||||
if ( ! fw_current_screen_match( $screen ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( get_user_option( 'fw-metaboxhidden_nav-menus' ) !== false ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$user = wp_get_current_user();
|
||||
$hidden_meta_boxes = get_user_meta( $user->ID, 'metaboxhidden_nav-menus' );
|
||||
|
||||
if ( $key = array_search( 'add-' . $this->taxonomy_name, $hidden_meta_boxes[0] ) ) {
|
||||
unset( $hidden_meta_boxes[0][ $key ] );
|
||||
}
|
||||
|
||||
update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes[0], true );
|
||||
update_user_option( $user->ID, 'fw-metaboxhidden_nav-menus', 'updated', true );
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function _action_admin_add_team_edit_page_filter() {
|
||||
$screen = fw_current_screen_match( array(
|
||||
'only' => array(
|
||||
'base' => 'edit',
|
||||
'id' => 'edit-' . $this->post_type,
|
||||
'post_type' => $this->post_type,
|
||||
)
|
||||
) );
|
||||
|
||||
if ( ! $screen ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$terms = get_terms( $this->taxonomy_name );
|
||||
|
||||
if ( empty( $terms ) || is_wp_error( $terms ) ) {
|
||||
echo '<select name="' . $this->get_name() . '-filter-by-team-category"><option value="0">' . __( 'View all categories',
|
||||
'mwtemplates' ) . '</option></select>';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$get = FW_Request::GET( $this->get_name() . '-filter-by-team-category' );
|
||||
$id = ( ! empty( $get ) ) ? (int) $get : 0;
|
||||
|
||||
$dropdown_options = array(
|
||||
'selected' => $id,
|
||||
'name' => $this->get_name() . '-filter-by-team-category">',
|
||||
'taxonomy' => $this->taxonomy_name,
|
||||
'show_option_all' => __( 'View all categories', 'mwtemplates' ),
|
||||
'hide_empty' => true,
|
||||
'hierarchical' => 1,
|
||||
'show_count' => 0,
|
||||
'orderby' => 'name',
|
||||
);
|
||||
|
||||
wp_dropdown_categories( $dropdown_options );
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @param array $columns
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function _filter_admin_manage_edit_columns( $columns ) {
|
||||
$new_columns = array();
|
||||
$new_columns['cb'] = $columns['cb']; // checkboxes for all team page
|
||||
$new_columns['image'] = __( 'Feat. Image', 'mwtemplates' );
|
||||
|
||||
return array_merge( $new_columns, $columns );
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @param WP_Query $query
|
||||
*
|
||||
* @return WP_Query
|
||||
*/
|
||||
public function _filter_admin_filter_team_by_team_category( $query ) {
|
||||
$screen = fw_current_screen_match( array(
|
||||
'only' => array(
|
||||
'base' => 'edit',
|
||||
'id' => 'edit-' . $this->post_type,
|
||||
'post_type' => $this->post_type,
|
||||
)
|
||||
) );
|
||||
|
||||
if ( ! $screen || ! $query->is_main_query() ) {
|
||||
return $query;
|
||||
}
|
||||
|
||||
$filter_value = FW_Request::GET( $this->get_name() . '-filter-by-team-category' );
|
||||
|
||||
if ( empty( $filter_value ) ) {
|
||||
return $query;
|
||||
}
|
||||
|
||||
$filter_value = (int) $filter_value;
|
||||
|
||||
$query->set( 'tax_query',
|
||||
array(
|
||||
array(
|
||||
'taxonomy' => $this->taxonomy_name,
|
||||
'field' => 'id',
|
||||
'terms' => $filter_value,
|
||||
)
|
||||
) );
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @param array $filters
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function _filter_admin_remove_select_by_date_filter( $filters ) {
|
||||
$screen = array(
|
||||
'only' => array(
|
||||
'base' => 'edit',
|
||||
'id' => 'edit-' . $this->post_type,
|
||||
)
|
||||
);
|
||||
|
||||
if ( ! fw_current_screen_match( $screen ) ) {
|
||||
return $filters;
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function _get_link() {
|
||||
return self_admin_url( 'edit.php?post_type=' . $this->post_type );
|
||||
}
|
||||
|
||||
public function get_settings() {
|
||||
|
||||
$response = array(
|
||||
'post_type' => $this->post_type,
|
||||
'slug' => $this->slug,
|
||||
'taxonomy_slug' => $this->taxonomy_slug,
|
||||
'taxonomy_name' => $this->taxonomy_name
|
||||
);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function get_image_sizes() {
|
||||
return $this->get_config( 'image_sizes' );
|
||||
}
|
||||
|
||||
public function get_post_type_name() {
|
||||
return $this->post_type;
|
||||
}
|
||||
|
||||
public function get_taxonomy_name() {
|
||||
return $this->taxonomy_name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php if ( ! defined( 'FW' ) ) {
|
||||
die( 'Forbidden' );
|
||||
}
|
||||
|
||||
$cfg = array();
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php if ( ! defined( 'FW' ) ) {
|
||||
die( 'Forbidden' );
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php if ( ! defined( 'FW' ) ) {
|
||||
die( 'Forbidden' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the content of the current template with the content of team view
|
||||
*
|
||||
* @param string $the_content
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function _filter_fw_ext_team_the_content( $the_content ) {
|
||||
/**
|
||||
* @var FW_Extension_Team $team
|
||||
*/
|
||||
$team = fw()->extensions->get( 'team' );
|
||||
|
||||
return fw_render_view( $team->locate_view_path( 'content' ), array( 'the_content' => $the_content ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the there are defined views for the team templates, otherwise are used theme templates
|
||||
*
|
||||
* @param string $template
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function _filter_fw_ext_team_template_include( $template ) {
|
||||
|
||||
/**
|
||||
* @var FW_Extension_Team $team
|
||||
*/
|
||||
$team = fw()->extensions->get( 'team' );
|
||||
|
||||
if ( is_singular( $team->get_post_type_name() ) ) {
|
||||
|
||||
if ( preg_match( '/single-' . '.*\.php/i', basename( $template ) ) === 1 ) {
|
||||
return $template;
|
||||
}
|
||||
|
||||
if ( $team->locate_view_path( 'single' ) ) {
|
||||
return $team->locate_view_path( 'single' );
|
||||
} else {
|
||||
add_filter( 'the_content', '_filter_fw_ext_team_the_content' );
|
||||
}
|
||||
} else if ( is_tax( $team->get_taxonomy_name() ) && $team->locate_view_path( 'taxonomy' ) ) {
|
||||
|
||||
if ( preg_match( '/taxonomy-' . '.*\.php/i', basename( $template ) ) === 1 ) {
|
||||
return $template;
|
||||
}
|
||||
|
||||
return $team->locate_view_path( 'taxonomy' );
|
||||
} else if ( is_post_type_archive( $team->get_post_type_name() ) && $team->locate_view_path( 'archive' ) ) {
|
||||
if ( preg_match( '/archive-' . '.*\.php/i', basename( $template ) ) === 1 ) {
|
||||
return $template;
|
||||
}
|
||||
|
||||
return $team->locate_view_path( 'archive' );
|
||||
}
|
||||
|
||||
return $template;
|
||||
}
|
||||
|
||||
add_filter( 'template_include', '_filter_fw_ext_team_template_include' );
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php if ( ! defined( 'FW' ) ) {
|
||||
die( 'Forbidden' );
|
||||
}
|
||||
|
||||
$manifest = array();
|
||||
|
||||
$manifest['name'] = __( 'Team', 'mwtemplates' );
|
||||
$manifest['description'] = __(
|
||||
'This extension will add a fully fledged team module that will let you display your team'
|
||||
.' using the built in team pages.',
|
||||
'mwtemplates'
|
||||
);
|
||||
$manifest['version'] = '1.0.0';
|
||||
$manifest['display'] = true;
|
||||
$manifest['standalone'] = true;
|
||||
$manifest['thumbnail'] = 'fa fa-user-o';
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php if ( ! defined( 'FW' ) ) {
|
||||
die( 'Forbidden' );
|
||||
}
|
||||
|
||||
class FW_Shortcode_Team extends FW_Shortcode {
|
||||
protected function _render( $atts, $content = null, $tag = '' ) {
|
||||
if ( ! isset( $atts['layout'] ) ) {
|
||||
return $this->get_error_msg();
|
||||
}
|
||||
|
||||
//get post type dynamically
|
||||
$ext_team_settings = fw()->extensions->get( 'team' )->get_settings();
|
||||
$post_type = $ext_team_settings['post_type'];
|
||||
$taxonomy_name = $ext_team_settings['taxonomy_name'];
|
||||
$terms = $atts['cat'];
|
||||
$tax_query = false;
|
||||
//if some terms are selected in options - creating tax_query
|
||||
if ( ! empty( $terms ) ) {
|
||||
$tax_query = array(
|
||||
array(
|
||||
'taxonomy' => $taxonomy_name,
|
||||
'terms' => $atts['cat'],
|
||||
),
|
||||
);
|
||||
}
|
||||
$posts = $this->fw_get_posts_with_info( array(
|
||||
'post_type' => $post_type,
|
||||
'orderby' => 'post_date',
|
||||
'posts_per_page' => $atts['number'],
|
||||
'tax_query' => $tax_query,
|
||||
|
||||
) );
|
||||
|
||||
$view_path = $this->locate_path( '/views/' . $atts['layout'] . '.php' );
|
||||
|
||||
return fw_render_view( $view_path, array(
|
||||
'atts' => $atts,
|
||||
'posts' => $posts
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $args
|
||||
*
|
||||
* @return 'WP_Query'
|
||||
*/
|
||||
public function fw_get_posts_with_info( $args = array() ) {
|
||||
$defaults = array(
|
||||
'orderby' => 'post_date',
|
||||
'posts_per_page' => 5,
|
||||
'post_type' => 'post',
|
||||
'cat' => false,
|
||||
);
|
||||
|
||||
$query = new WP_Query( wp_parse_args( $args, $defaults ) );
|
||||
|
||||
//removed wp reset query
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
private function get_error_msg() {
|
||||
return '<p>' . esc_html__( 'No view found', 'mwtemplates' ) . '</p>';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php if ( ! defined( 'FW' ) ) {
|
||||
die( 'Forbidden' );
|
||||
}
|
||||
|
||||
$cfg = array(
|
||||
'page_builder' => array(
|
||||
'title' => esc_html__( 'Team', 'mwtemplates' ),
|
||||
'description' => esc_html__( 'Team various views', 'mwtemplates' ),
|
||||
'tab' => esc_html__( 'Widgets', 'mwtemplates' )
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,119 @@
|
||||
<?php if ( ! defined( 'FW' ) ) {
|
||||
die( 'Forbidden' );
|
||||
}
|
||||
|
||||
$ext_team_settings = fw()->extensions->get( 'team' )->get_settings();
|
||||
$taxonomy = $ext_team_settings['taxonomy_name'];
|
||||
|
||||
$options = array(
|
||||
'number' => array(
|
||||
'type' => 'slider',
|
||||
'value' => 6,
|
||||
'properties' => array(
|
||||
'min' => 1,
|
||||
'max' => 12,
|
||||
'step' => 1, // Set slider step. Always > 0. Could be fractional.
|
||||
|
||||
),
|
||||
'label' => esc_html__( 'Items number', 'mwtemplates' ),
|
||||
'desc' => esc_html__( 'Number of posts to display', 'mwtemplates' ),
|
||||
),
|
||||
'margin' => array(
|
||||
'label' => esc_html__( 'Horizontal item margin (px)', 'mwtemplates' ),
|
||||
'desc' => esc_html__( 'Select horizontal item margin', 'mwtemplates' ),
|
||||
'value' => '30',
|
||||
'type' => 'select',
|
||||
'choices' => array(
|
||||
'0' => esc_html__( '0', 'mwtemplates' ),
|
||||
'1' => esc_html__( '1px', 'mwtemplates' ),
|
||||
'2' => esc_html__( '2px', 'mwtemplates' ),
|
||||
'10' => esc_html__( '10px', 'mwtemplates' ),
|
||||
'30' => esc_html__( '30px', 'mwtemplates' ),
|
||||
)
|
||||
),
|
||||
'layout' => array(
|
||||
'label' => esc_html__( 'Layout', 'mwtemplates' ),
|
||||
'desc' => esc_html__( 'Choose layout', 'mwtemplates' ),
|
||||
'value' => 'carousel',
|
||||
'type' => 'select',
|
||||
'choices' => array(
|
||||
'carousel' => esc_html__( 'Carousel', 'mwtemplates' ),
|
||||
'isotope' => esc_html__( 'Masonry Grid', 'mwtemplates' ),
|
||||
)
|
||||
),
|
||||
'responsive_lg' => array(
|
||||
'label' => esc_html__( 'Columns on large screens', 'mwtemplates' ),
|
||||
'desc' => esc_html__( 'Select items number on wide screens (>1200px)', 'mwtemplates' ),
|
||||
'value' => '4',
|
||||
'type' => 'select',
|
||||
'choices' => array(
|
||||
'1' => esc_html__( '1', 'mwtemplates' ),
|
||||
'2' => esc_html__( '2', 'mwtemplates' ),
|
||||
'3' => esc_html__( '3', 'mwtemplates' ),
|
||||
'4' => esc_html__( '4', 'mwtemplates' ),
|
||||
'6' => esc_html__( '6', 'mwtemplates' ),
|
||||
)
|
||||
),
|
||||
'responsive_md' => array(
|
||||
'label' => esc_html__( 'Columns on middle screens', 'mwtemplates' ),
|
||||
'desc' => esc_html__( 'Select items number on middle screens (>992px)', 'mwtemplates' ),
|
||||
'value' => '3',
|
||||
'type' => 'select',
|
||||
'choices' => array(
|
||||
'1' => esc_html__( '1', 'mwtemplates' ),
|
||||
'2' => esc_html__( '2', 'mwtemplates' ),
|
||||
'3' => esc_html__( '3', 'mwtemplates' ),
|
||||
'4' => esc_html__( '4', 'mwtemplates' ),
|
||||
'6' => esc_html__( '6', 'mwtemplates' ),
|
||||
)
|
||||
),
|
||||
'responsive_sm' => array(
|
||||
'label' => esc_html__( 'Columns on small screens', 'mwtemplates' ),
|
||||
'desc' => esc_html__( 'Select items number on small screens (>768px)', 'mwtemplates' ),
|
||||
'value' => '2',
|
||||
'type' => 'select',
|
||||
'choices' => array(
|
||||
'1' => esc_html__( '1', 'mwtemplates' ),
|
||||
'2' => esc_html__( '2', 'mwtemplates' ),
|
||||
'3' => esc_html__( '3', 'mwtemplates' ),
|
||||
'4' => esc_html__( '4', 'mwtemplates' ),
|
||||
'6' => esc_html__( '6', 'mwtemplates' ),
|
||||
)
|
||||
),
|
||||
'responsive_xs' => array(
|
||||
'label' => esc_html__( 'Columns on extra small screens', 'mwtemplates' ),
|
||||
'desc' => esc_html__( 'Select items number on extra small screens (<767px)', 'mwtemplates' ),
|
||||
'value' => '1',
|
||||
'type' => 'select',
|
||||
'choices' => array(
|
||||
'1' => esc_html__( '1', 'mwtemplates' ),
|
||||
'2' => esc_html__( '2', 'mwtemplates' ),
|
||||
'3' => esc_html__( '3', 'mwtemplates' ),
|
||||
'4' => esc_html__( '4', 'mwtemplates' ),
|
||||
'6' => esc_html__( '6', 'mwtemplates' ),
|
||||
)
|
||||
),
|
||||
'show_filters' => array(
|
||||
'type' => 'switch',
|
||||
'value' => false,
|
||||
'label' => esc_html__( 'Show filters', 'mwtemplates' ),
|
||||
'desc' => esc_html__( 'Hide or show categories filters', 'mwtemplates' ),
|
||||
'left-choice' => array(
|
||||
'value' => false,
|
||||
'label' => esc_html__( 'No', 'mwtemplates' ),
|
||||
),
|
||||
'right-choice' => array(
|
||||
'value' => true,
|
||||
'label' => esc_html__( 'Yes', 'mwtemplates' ),
|
||||
),
|
||||
),
|
||||
'cat' => array(
|
||||
'type' => 'multi-select',
|
||||
'label' => esc_html__('Select categories', 'mwtemplates'),
|
||||
'desc' => esc_html__('You can select one or more categories', 'mwtemplates'),
|
||||
'population' => 'taxonomy',
|
||||
'source' => $taxonomy,
|
||||
'prepopulate' => 10,
|
||||
'limit' => 100,
|
||||
)
|
||||
);
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 178 B |
@@ -0,0 +1,49 @@
|
||||
<?php if ( ! defined( 'FW' ) ) {
|
||||
die( 'Forbidden' );
|
||||
}
|
||||
/**
|
||||
* @var array $atts
|
||||
* @var array $posts
|
||||
*/
|
||||
|
||||
$unique_id = uniqid();
|
||||
|
||||
$categories = fw_ext_extension_get_listing_categories( $atts['cat'], 'team' );
|
||||
$sort_classes = fw_ext_extension_get_sort_classes( $posts->posts, $categories, '', 'team' );
|
||||
|
||||
if ( $atts['show_filters'] ) : ?>
|
||||
<div class="filters carousel_filters-<?php echo esc_attr( $unique_id ); ?> text-center">
|
||||
<a href="#" data-filter="*" class="selected"><?php esc_html_e( 'All', 'mwtemplates' ); ?></a>
|
||||
<?php
|
||||
foreach ( $categories as $category ) {
|
||||
?>
|
||||
<a href="#"
|
||||
data-filter=".<?php echo esc_attr( $category->slug ); ?>"><?php echo esc_html( $category->name ); ?></a>
|
||||
<?php
|
||||
} //foreach
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
endif; //showfilters check
|
||||
?>
|
||||
<div
|
||||
class="owl-carousel"
|
||||
data-nav="true"
|
||||
data-margin="<?php echo esc_attr( $atts['margin'] ); ?>"
|
||||
data-responsive-xs="<?php echo esc_attr( $atts['responsive_xs'] ); ?>"
|
||||
data-responsive-sm="<?php echo esc_attr( $atts['responsive_sm'] ); ?>"
|
||||
data-responsive-md="<?php echo esc_attr( $atts['responsive_md'] ); ?>"
|
||||
data-responsive-lg="<?php echo esc_attr( $atts['responsive_lg'] ); ?>"
|
||||
<?php if ( $atts['show_filters'] ) : ?>
|
||||
data-filters=".carousel_filters-<?php echo esc_attr( $unique_id ); ?>"
|
||||
<?php endif; // filters ?>
|
||||
>
|
||||
<?php while ( $posts->have_posts() ) : $posts->the_post(); ?>
|
||||
<div class="owl-carousel-item <?php echo esc_attr( $sort_classes[get_the_ID()] ); ?>">
|
||||
<?php
|
||||
include( fw()->extensions->get( 'team' )->locate_view_path( 'loop-item' ) );
|
||||
?>
|
||||
</div>
|
||||
<?php endwhile; ?>
|
||||
<?php wp_reset_postdata(); // reset the query ?>
|
||||
</div>
|
||||
@@ -0,0 +1,173 @@
|
||||
<?php if ( ! defined( 'FW' ) ) {
|
||||
die( 'Forbidden' );
|
||||
}
|
||||
/**
|
||||
* @var array $atts
|
||||
* @var array $posts
|
||||
*/
|
||||
|
||||
//1 - col-*-12
|
||||
//2 - col-*-6
|
||||
//3 - col-*-4
|
||||
//4 - col-*-3
|
||||
//6 - col-*-2
|
||||
|
||||
//bootstrap col-lg-* class
|
||||
$lg_class = '';
|
||||
switch ( $atts['responsive_lg'] ) :
|
||||
case ( 1 ) :
|
||||
$lg_class = 'col-lg-12';
|
||||
break;
|
||||
|
||||
case ( 2 ) :
|
||||
$lg_class = 'col-lg-6';
|
||||
break;
|
||||
|
||||
case ( 3 ) :
|
||||
$lg_class = 'col-lg-4';
|
||||
break;
|
||||
|
||||
case ( 4 ) :
|
||||
$lg_class = 'col-lg-3';
|
||||
break;
|
||||
//6
|
||||
default:
|
||||
$lg_class = 'col-lg-2';
|
||||
endswitch;
|
||||
|
||||
//bootstrap col-md-* class
|
||||
$md_class = '';
|
||||
switch ( $atts['responsive_md'] ) :
|
||||
case ( 1 ) :
|
||||
$md_class = 'col-md-12';
|
||||
break;
|
||||
|
||||
case ( 2 ) :
|
||||
$md_class = 'col-md-6';
|
||||
break;
|
||||
|
||||
case ( 3 ) :
|
||||
$md_class = 'col-md-4';
|
||||
break;
|
||||
|
||||
case ( 4 ) :
|
||||
$md_class = 'col-md-3';
|
||||
break;
|
||||
//6
|
||||
default:
|
||||
$md_class = 'col-md-2';
|
||||
endswitch;
|
||||
|
||||
//bootstrap col-sm-* class
|
||||
$sm_class = '';
|
||||
switch ( $atts['responsive_sm'] ) :
|
||||
case ( 1 ) :
|
||||
$sm_class = 'col-sm-12';
|
||||
break;
|
||||
|
||||
case ( 2 ) :
|
||||
$sm_class = 'col-sm-6';
|
||||
break;
|
||||
|
||||
case ( 3 ) :
|
||||
$sm_class = 'col-sm-4';
|
||||
break;
|
||||
|
||||
case ( 4 ) :
|
||||
$sm_class = 'col-sm-3';
|
||||
break;
|
||||
//6
|
||||
default:
|
||||
$sm_class = 'col-sm-2';
|
||||
endswitch;
|
||||
|
||||
//bootstrap col-xs-* class
|
||||
$xs_class = '';
|
||||
switch ( $atts['responsive_xs'] ) :
|
||||
case ( 1 ) :
|
||||
$xs_class = 'col-xs-12';
|
||||
break;
|
||||
|
||||
case ( 2 ) :
|
||||
$xs_class = 'col-xs-6';
|
||||
break;
|
||||
|
||||
case ( 3 ) :
|
||||
$xs_class = 'col-xs-4';
|
||||
break;
|
||||
|
||||
case ( 4 ) :
|
||||
$xs_class = 'col-xs-3';
|
||||
break;
|
||||
//6
|
||||
default:
|
||||
$xs_class = 'col-xs-2';
|
||||
endswitch;
|
||||
|
||||
//column paddings class
|
||||
//margin values:
|
||||
//0
|
||||
//1
|
||||
//2
|
||||
//10
|
||||
//30
|
||||
$margin_class = '';
|
||||
switch ( $atts['margin'] ) :
|
||||
case ( 0 ) :
|
||||
$margin_class = 'columns_padding_0';
|
||||
break;
|
||||
|
||||
case ( 1 ) :
|
||||
$margin_class = 'columns_padding_1';
|
||||
break;
|
||||
|
||||
case ( 2 ) :
|
||||
$margin_class = 'columns_padding_2';
|
||||
break;
|
||||
|
||||
case ( 10 ) :
|
||||
$margin_class = 'columns_padding_5';
|
||||
break;
|
||||
//6
|
||||
default:
|
||||
$margin_class = 'columns_padding_15';
|
||||
endswitch;
|
||||
|
||||
$unique_id = uniqid();
|
||||
|
||||
$categories = fw_ext_extension_get_listing_categories( $atts['cat'], 'team' );
|
||||
$sort_classes = fw_ext_extension_get_sort_classes( $posts->posts, $categories, '', 'team' );
|
||||
|
||||
if ( $atts['show_filters'] ) : ?>
|
||||
<div class="filters isotope_filters-<?php echo esc_attr( $unique_id ); ?> text-center">
|
||||
<a href="#" data-filter="*" class="selected"><?php esc_html_e( 'All', 'mwtemplates' ); ?></a>
|
||||
<?php
|
||||
foreach ( $categories as $category ) {
|
||||
?>
|
||||
<a href="#"
|
||||
data-filter=".<?php echo esc_attr( $category->slug ); ?>"><?php echo esc_html( $category->name ); ?></a>
|
||||
<?php
|
||||
} //foreach
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
endif; //showfilters check
|
||||
|
||||
?>
|
||||
<div class="<?php echo esc_attr( $margin_class ); ?>">
|
||||
<div class="isotope_container isotope row masonry-layout columns_margin_bottom_20"
|
||||
<?php if ( $atts['show_filters'] ) : ?>
|
||||
data-filters=".isotope_filters-<?php echo esc_attr( $unique_id ); ?>"
|
||||
<?php endif; // filters ?>
|
||||
>
|
||||
<?php while ( $posts->have_posts() ) : $posts->the_post(); ?>
|
||||
<div
|
||||
class="isotope-item <?php echo esc_attr( $lg_class . ' ' . $md_class . ' ' . $sm_class . ' ' . $xs_class . ' ' . $sort_classes[get_the_ID()] ); ?>">
|
||||
<?php
|
||||
include( fw()->extensions->get( 'team' )->locate_view_path( 'loop-item' ) );
|
||||
?>
|
||||
</div>
|
||||
<?php endwhile; ?>
|
||||
<?php wp_reset_postdata(); // reset the query ?>
|
||||
</div><!-- eof .isotope_container -->
|
||||
</div><!-- eof .columns_padding_* -->
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php if ( ! defined( 'FW' ) ) {
|
||||
die( 'Forbidden' );
|
||||
}
|
||||
|
||||
if ( ! is_admin() ) {
|
||||
|
||||
/**
|
||||
* @var FW_Extension_Team $team
|
||||
*/
|
||||
$team = fw()->extensions->get( 'team' );
|
||||
|
||||
//put your addition static assets here
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
#fw-options-box-icon_box.team-icon-postbox .inside {
|
||||
margin-top: 0 !important;
|
||||
padding-bottom: 0 !important;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
table.wp-list-table td.column-image {
|
||||
line-height: 0;
|
||||
}
|
||||
|
||||
table.wp-list-table th.manage-column.column-image {
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
#posts-filter th.column-posts span{
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 1450px) {
|
||||
#posts-filter th.column-posts{
|
||||
width: 20%;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
@@ -0,0 +1 @@
|
||||
jQuery('#fw-backend-option-fw-option-team_icon').closest('.postbox').addClass('team-icon-postbox');
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/**
|
||||
* The template for default displaying portfolio taxonomy
|
||||
*/
|
||||
get_header();
|
||||
//no columns on this page - giving true as a parameter to get column classes function
|
||||
$column_classes = fw_ext_extension_get_columns_classes( true );
|
||||
|
||||
//getting taxonomy name
|
||||
$ext_team_settings = fw()->extensions->get( 'team' )->get_settings();
|
||||
$taxonomy_name = $ext_team_settings['taxonomy_name'];
|
||||
|
||||
$categories = fw_ext_extension_get_listing_categories( array(), 'team' );
|
||||
global $wp_query;
|
||||
$sort_classes = fw_ext_extension_get_sort_classes( $wp_query->posts, $categories, '', 'team' );
|
||||
|
||||
$unique_id = uniqid();
|
||||
?>
|
||||
<div id="content" class="<?php echo esc_attr( $column_classes['main_column_class'] ); ?>">
|
||||
<?php
|
||||
if ( count( $categories ) > 1 ) : ?>
|
||||
<div class="filters isotope_filters-<?php echo esc_attr( $unique_id ); ?> text-center">
|
||||
<a href="#" data-filter="*" class="selected"><?php esc_html_e( 'All', 'mwtemplates' ); ?></a>
|
||||
<?php foreach ( $categories as $category ) : ?>
|
||||
<a href="#"
|
||||
data-filter=".<?php echo esc_attr( $category->slug ); ?>"><?php echo esc_html( $category->name ); ?></a>
|
||||
<?php endforeach; ?>
|
||||
</div><!-- eof isotope_filters -->
|
||||
<?php endif; //count subcategories check ?>
|
||||
<?php if ( have_posts() ) : ?>
|
||||
<div class="isotope_container isotope row masonry-layout columns_margin_bottom_20"
|
||||
<?php if ( count( $categories ) > 1 ) { ?>
|
||||
data-filters=".isotope_filters-<?php echo esc_attr( $unique_id ); ?>"
|
||||
<?php } ?>
|
||||
>
|
||||
<?php
|
||||
while ( have_posts() ) : the_post();
|
||||
|
||||
?>
|
||||
<div
|
||||
class="isotope-item col-lg-4 col-md-6 col-sm-12 <?php echo esc_attr( $sort_classes[get_the_ID()] ); ?>">
|
||||
<?php
|
||||
include( fw()->extensions->get( 'team' )->locate_view_path( 'loop-item' ) );
|
||||
?>
|
||||
</div>
|
||||
<?php endwhile; ?>
|
||||
</div><!-- eof isotope_container -->
|
||||
<?php
|
||||
else :
|
||||
// If no content, include the "No posts found" template.
|
||||
get_template_part( 'template-parts/content', 'none' );
|
||||
endif; ?>
|
||||
<?php // Pagination.
|
||||
$pagination = paginate_links( array(
|
||||
'prev_text' => __( 'Prev' ),
|
||||
'next_text' => __( 'Next' ),
|
||||
'type' => 'list',
|
||||
));
|
||||
if ($pagination) {
|
||||
echo '<nav class="pagination-nav">' . wp_kses_post( str_replace( 'page-numbers', 'page-numbers pagination', $pagination ) ) . '</nav>';
|
||||
}
|
||||
?>
|
||||
</div><!--eof #content -->
|
||||
|
||||
<?php if ( $column_classes['sidebar_class'] ): ?>
|
||||
<!-- main aside sidebar -->
|
||||
<aside class="<?php echo esc_attr( $column_classes['sidebar_class'] ); ?>">
|
||||
<?php get_sidebar(); ?>
|
||||
</aside>
|
||||
<!-- eof main aside sidebar -->
|
||||
<?php
|
||||
endif;
|
||||
get_footer();
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php if ( ! defined( 'FW' ) ) {
|
||||
die( 'Forbidden' );
|
||||
}
|
||||
/**
|
||||
* Single service loop item layout
|
||||
* also using as a default service view in a shortcode
|
||||
*/
|
||||
|
||||
$ext_team_settings = fw()->extensions->get( 'team' )->get_settings();
|
||||
$taxonomy_name = $ext_team_settings['taxonomy_name'];
|
||||
|
||||
$pID = get_the_ID();
|
||||
$atts = fw_get_db_post_option($pID);
|
||||
|
||||
?>
|
||||
<div class="vertical-item content-padding with_border text-center">
|
||||
|
||||
<?php if ( has_post_thumbnail() ) : ?>
|
||||
<div class="item-media">
|
||||
<?php
|
||||
$full_image_src = wp_get_attachment_url( get_post_thumbnail_id( $pID ) );
|
||||
the_post_thumbnail();
|
||||
?>
|
||||
<div class="media-links">
|
||||
<a class="abs-link" href="<?php the_permalink(); ?>"></a>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; //has_post_thumbnail ?>
|
||||
<div class="item-content">
|
||||
|
||||
<h3 class="bottommargin_0">
|
||||
<a href="<?php the_permalink(); ?>">
|
||||
<?php the_title(); ?>
|
||||
</a>
|
||||
</h3>
|
||||
<?php if ( ! empty( $atts['position'] ) ) : ?>
|
||||
<p class="small-text highlight"><strong><?php echo wp_kses_post( $atts['position'] ); ?></strong></p>
|
||||
<?php endif; //position ?>
|
||||
|
||||
<?php if ( ! empty( $atts['social_icons'] ) ) : ?>
|
||||
<div class="team-social-icons">
|
||||
<?php
|
||||
//get icons-social shortcode to render icons in team member item
|
||||
$shortcodes_extension = fw()->extensions->get( 'shortcodes' );
|
||||
if ( ! empty( $shortcodes_extension ) ) {
|
||||
echo fw_ext( 'shortcodes' )->get_shortcode( 'icons_social' )->render( array( 'social_icons' => $atts['social_icons'] ) );
|
||||
}
|
||||
?>
|
||||
</div><!-- eof social icons -->
|
||||
<?php endif; //social icons ?>
|
||||
|
||||
<div class="theme_buttons small_buttons color1">
|
||||
<?php
|
||||
echo get_the_term_list( $pID, $taxonomy_name, '', ' ', '' );
|
||||
?>
|
||||
</div>
|
||||
<p>
|
||||
<?php the_excerpt(); ?>
|
||||
</p>
|
||||
<p class="topmargin_25">
|
||||
<a href="<?php the_permalink(); ?>" class="theme_button wide_button inverse">
|
||||
<?php esc_html_e( 'Learn More', 'mwtemplates' ); ?>
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
</div><!-- eof .vertical-item -->
|
||||
@@ -0,0 +1,183 @@
|
||||
<?php if ( ! defined( 'FW' ) ) {
|
||||
die( 'Forbidden' );
|
||||
}
|
||||
/**
|
||||
* The template for displaying single service
|
||||
*
|
||||
*/
|
||||
|
||||
get_header();
|
||||
$pID = get_the_ID();
|
||||
|
||||
//no columns on single service page
|
||||
$column_classes = fw_ext_extension_get_columns_classes( true );
|
||||
|
||||
//getting taxonomy name
|
||||
$ext_team_settings = fw()->extensions->get( 'team' )->get_settings();
|
||||
$taxonomy_name = $ext_team_settings['taxonomy_name'];
|
||||
|
||||
$atts = fw_get_db_post_option(get_the_ID());
|
||||
|
||||
$shortcodes_extension = fw()->extensions->get( 'shortcodes' );
|
||||
|
||||
$unique_id = uniqid();
|
||||
?>
|
||||
<div id="content" class="<?php echo esc_attr( $column_classes['main_column_class'] ); ?>">
|
||||
<?php
|
||||
// Start the Loop.
|
||||
while ( have_posts() ) : the_post(); ?>
|
||||
<article id="post-<?php the_ID(); ?>" <?php post_class('row columns_padding_25'); ?>>
|
||||
<div class="col-md-5">
|
||||
<div class="vertical-item content-padding with_border text-center">
|
||||
<div class="item-media">
|
||||
<?php the_post_thumbnail(); ?>
|
||||
</div>
|
||||
<div class="item-content">
|
||||
<?php if ( get_the_term_list( $pID, $taxonomy_name ) ) : ?>
|
||||
|
||||
<div class="categories-links bottommargin_30 theme_buttons small_buttons color1">
|
||||
<?php
|
||||
echo get_the_term_list( $pID, $taxonomy_name, '', ' ', '' );
|
||||
?>
|
||||
</div>
|
||||
<?php endif; //get_the_term_list ?>
|
||||
<?php the_title( '<h3 class="bottommargin_0">', '</h3>' ); ?>
|
||||
<?php if ( ! empty( $atts['position'] ) ) : ?>
|
||||
<p class="small-text highlight"><strong><?php echo wp_kses_post( $atts['position'] ); ?></strong></p>
|
||||
<?php endif; //position ?>
|
||||
|
||||
<?php if ( ! empty( $atts['social_icons'] ) ) : ?>
|
||||
<div class="team-social-icons">
|
||||
<?php
|
||||
if ( ! empty( $shortcodes_extension ) ) {
|
||||
echo fw_ext( 'shortcodes' )->get_shortcode( 'icons_social' )->render( array( 'social_icons' => $atts['social_icons'] ) );
|
||||
}
|
||||
?>
|
||||
</div><!-- eof social icons -->
|
||||
<?php endif; //social icons ?>
|
||||
|
||||
<?php if ( ! empty( $atts['icons'] ) ) : ?>
|
||||
<div class="member-info">
|
||||
<?php
|
||||
if ( ! empty( $shortcodes_extension ) ) {
|
||||
echo fw_ext( 'shortcodes' )->get_shortcode( 'icons_list' )->render( array( 'icons' => $atts['icons'] ) );
|
||||
}
|
||||
?>
|
||||
</div><!-- eof social icons -->
|
||||
<?php endif; //social icons ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- .col-md-5 -->
|
||||
<div class="col-md-7">
|
||||
|
||||
<?php the_content(); ?>
|
||||
|
||||
<?php
|
||||
//member meta tabs start
|
||||
if (
|
||||
! empty( $atts['bio'] )
|
||||
||
|
||||
! empty( $atts['skills'] )
|
||||
||
|
||||
! empty( json_decode($atts['form']['json'])[1] )
|
||||
) :
|
||||
$tab_num = 0;
|
||||
?>
|
||||
<div class="bootstrap-tabs">
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<?php
|
||||
if ( ! empty( $atts['bio'] ) ) :
|
||||
?>
|
||||
<li class="<?php echo ( $tab_num === 0 ) ? 'active' : '' ?>">
|
||||
<a href="#tab-<?php echo esc_attr( $unique_id . '-' . $tab_num ); ?>" role="tab" data-toggle="tab">
|
||||
<?php esc_html_e( 'Bio', 'mwtemplates' ); ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php
|
||||
$tab_num++;
|
||||
endif; //bio check
|
||||
|
||||
if ( ! empty( $atts['skills'] ) ) :
|
||||
?>
|
||||
<li class="<?php echo ( $tab_num === 0 ) ? 'active' : '' ?>">
|
||||
<a href="#tab-<?php echo esc_attr( $unique_id . '-' . $tab_num ); ?>" role="tab" data-toggle="tab">
|
||||
<?php esc_html_e( 'Skills', 'mwtemplates' ); ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php
|
||||
$tab_num++;
|
||||
endif; //bio check
|
||||
|
||||
if ( ! empty( json_decode($atts['form']['json'])[1] ) ) :
|
||||
?>
|
||||
<li class="<?php echo ( $tab_num === 0 ) ? 'active' : '' ?>">
|
||||
<a href="#tab-<?php echo esc_attr( $unique_id . '-' . $tab_num ); ?>" role="tab" data-toggle="tab">
|
||||
<?php esc_html_e( 'Send Message', 'mwtemplates' ); ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php
|
||||
$tab_num++;
|
||||
endif; //form check
|
||||
?>
|
||||
</ul>
|
||||
<div class="tab-content top-color-border">
|
||||
<?php
|
||||
$tab_num = 0;
|
||||
if ( ! empty( $atts['bio'] ) ) :
|
||||
?>
|
||||
<div class="tab-pane tab-member-bio fade <?php echo ( $tab_num === 0 ) ? 'in active' : '' ?>"
|
||||
id="tab-<?php echo esc_attr( $unique_id ) . '-' . $tab_num ?>">
|
||||
<?php echo wp_kses_post( $atts['bio'] ); ?>
|
||||
</div><!-- .eof tab-pane -->
|
||||
<?php
|
||||
$tab_num++;
|
||||
endif; //bio check
|
||||
|
||||
if ( ! empty( $atts['skills'] ) ) :
|
||||
?>
|
||||
<div class="tab-pane tab-member-skills fade <?php echo ( $tab_num === 0 ) ? 'in active' : '' ?>"
|
||||
id="tab-<?php echo esc_attr( $unique_id ) . '-' . $tab_num ?>">
|
||||
<?php
|
||||
foreach($atts['skills'] as $skill) :
|
||||
echo fw_ext( 'shortcodes' )->get_shortcode( 'progress_bar' )->render( $skill );
|
||||
endforeach;
|
||||
?>
|
||||
</div><!-- .eof tab-pane -->
|
||||
<?php
|
||||
$tab_num++;
|
||||
endif; //skills check
|
||||
|
||||
if ( ! empty( json_decode($atts['form']['json'])[1] ) ) :
|
||||
?>
|
||||
<div class="tab-pane tab-member-form fade <?php echo ( $tab_num === 0 ) ? 'in active' : '' ?>"
|
||||
id="tab-<?php echo esc_attr( $unique_id ) . '-' . $tab_num ?>">
|
||||
<?php echo fw_ext( 'shortcodes' )->get_shortcode( 'contact_form' )->render( $atts ); ?>
|
||||
</div><!-- .eof tab-pane -->
|
||||
<?php
|
||||
$tab_num++;
|
||||
endif; //form check
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; //tab content check ?>
|
||||
|
||||
<?php if ( ! empty( $atts['additional_content'] ) ) : ?>
|
||||
<div class="member-additional-content topmargin_30">
|
||||
<?php echo wp_kses_post( $atts['additional_content'] ); ?>
|
||||
</div>
|
||||
<?php endif; //additional content ?>
|
||||
|
||||
</div>
|
||||
</article><!-- #post-## -->
|
||||
<?php endwhile; ?>
|
||||
</div><!--eof #content -->
|
||||
<?php if ( $column_classes['sidebar_class'] ): ?>
|
||||
<!-- main aside sidebar -->
|
||||
<aside class="<?php echo esc_attr( $column_classes['sidebar_class'] ); ?>">
|
||||
<?php get_sidebar(); ?>
|
||||
</aside>
|
||||
<!-- eof main aside sidebar -->
|
||||
<?php
|
||||
endif;
|
||||
get_footer();
|
||||
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
/**
|
||||
* The template for displaying team taxonomy
|
||||
*/
|
||||
get_header();
|
||||
//no columns on this page - giving true as a parameter to get column classes function
|
||||
$column_classes = fw_ext_extension_get_columns_classes( true );
|
||||
|
||||
//getting taxonomy name
|
||||
$ext_team_settings = fw()->extensions->get( 'team' )->get_settings();
|
||||
$taxonomy_name = $ext_team_settings['taxonomy_name'];
|
||||
|
||||
$categories = fw_ext_extension_get_listing_categories( array(), 'team' );
|
||||
global $wp_query;
|
||||
$sort_classes = fw_ext_extension_get_sort_classes( $wp_query->posts, $categories, '', 'team' );
|
||||
|
||||
//get taxonomy settings
|
||||
$queried_object = get_queried_object();
|
||||
$atts = fw_get_db_term_option( $queried_object->term_taxonomy_id, $queried_object->taxonomy );
|
||||
|
||||
$unique_id = uniqid();
|
||||
?>
|
||||
<div id="content" class="<?php echo esc_attr( $column_classes['main_column_class'] ); ?>">
|
||||
<?php
|
||||
//no need to show filters on category set check to 100 categories
|
||||
if ( count( $categories ) > 100 ) : ?>
|
||||
<div class="filters isotope_filters-<?php echo esc_attr( $unique_id ); ?> text-center">
|
||||
<a href="#" data-filter="*" class="selected"><?php esc_html_e( 'All', 'mwtemplates' ); ?></a>
|
||||
<?php foreach ( $categories as $category ) : ?>
|
||||
<a href="#"
|
||||
data-filter=".<?php echo esc_attr( $category->slug ); ?>"><?php echo esc_html( $category->name ); ?></a>
|
||||
<?php endforeach; ?>
|
||||
</div><!-- eof isotope_filters -->
|
||||
<?php endif; //count subcategories check ?>
|
||||
<?php if ( have_posts() ) : ?>
|
||||
<div class="isotope_container isotope row masonry-layout columns_margin_bottom_20"
|
||||
<?php if ( count( $categories ) > 100 ) { ?>
|
||||
data-filters=".isotope_filters-<?php echo esc_attr( $unique_id ); ?>"
|
||||
<?php } ?>
|
||||
>
|
||||
<?php
|
||||
while ( have_posts() ) : the_post();
|
||||
?>
|
||||
<div
|
||||
class="isotope-item col-lg-4 col-md-6 col-sm-12 <?php echo esc_attr( $sort_classes[get_the_ID()] ); ?>">
|
||||
<?php
|
||||
include( fw()->extensions->get( 'team' )->locate_view_path( 'loop-item' ) );
|
||||
?>
|
||||
</div>
|
||||
<?php endwhile; ?>
|
||||
</div><!-- eof isotope_container -->
|
||||
<?php
|
||||
else :
|
||||
// If no content, include the "No posts found" template.
|
||||
get_template_part( 'template-parts/content', 'none' );
|
||||
endif;
|
||||
?>
|
||||
<?php // Previous/next page navigation.
|
||||
$pagination = paginate_links( array(
|
||||
'prev_text' => __( 'Prev' ),
|
||||
'next_text' => __( 'Next' ),
|
||||
'type' => 'list',
|
||||
));
|
||||
if ($pagination) {
|
||||
echo '<nav class="pagination-nav">' . wp_kses_post( str_replace( 'page-numbers', 'page-numbers pagination', $pagination ) ) . '</nav>';
|
||||
}
|
||||
?>
|
||||
</div><!--eof #content -->
|
||||
|
||||
<?php if ( $column_classes['sidebar_class'] ): ?>
|
||||
<!-- main aside sidebar -->
|
||||
<aside class="<?php echo esc_attr( $column_classes['sidebar_class'] ); ?>">
|
||||
<?php get_sidebar(); ?>
|
||||
</aside>
|
||||
<!-- eof main aside sidebar -->
|
||||
<?php
|
||||
endif;
|
||||
get_footer();
|
||||
Reference in New Issue
Block a user