first commit

This commit is contained in:
Roman Pyrih
2023-07-24 08:30:51 +02:00
commit c2e100a763
7128 changed files with 1622619 additions and 0 deletions

View File

@@ -0,0 +1,589 @@
<?php if ( ! defined( 'FW' ) ) {
die( 'Forbidden' );
}
class FW_Extension_Services extends FW_Extension {
private $post_type = 'fw-services';
private $slug = 'service';
private $taxonomy_slug = 'services';
private $taxonomy_name = 'fw-services-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_services_post_slug',
$this->get_db_data( 'permalinks/post', $this->slug )
);
$this->taxonomy_slug = apply_filters(
'fw_ext_services_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_services' ) );
add_action( 'restrict_manage_posts', array( $this, '_action_admin_add_services_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_services_service_slug',
apply_filters( 'fw_ext_services_post_slug', $this->slug )
);
$taxonomy = FW_Request::POST( 'fw_ext_services_services_slug',
apply_filters( 'fw_ext_services_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_services_service_slug',
__( 'Service base', 'fw' ),
array( $this, '_service_slug_input' ),
'permalink',
'optional'
);
add_settings_field(
'fw_ext_services_services_slug',
__( 'Services category base', 'fw' ),
array( $this, '_services_slug_input' ),
'permalink',
'optional'
);
}
/**
* @internal
*/
public function _service_slug_input() {
?>
<input type="text" name="fw_ext_services_service_slug" value="<?php echo $this->slug; ?>">
<code>/my-service</code>
<?php
}
/**
* @internal
*/
public function _services_slug_input() {
?>
<input type="text" name="fw_ext_services_services_slug" value="<?php echo $this->taxonomy_slug; ?>">
<code>/my-services</code>
<?php
}
public function add_admin_filters() {
add_filter( 'parse_query', array( $this, '_filter_admin_filter_servicess_by_services_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 );
if ( $this->get_config( 'has-icon' ) === true ) {
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() {
$services_listing_screen = array(
'only' => array(
array(
'post_type' => $this->post_type,
'base' => array( 'edit' )
)
)
);
$services_add_edit_screen = array(
'only' => array(
array(
'post_type' => $this->post_type,
'base' => 'post'
)
)
);
if ( fw_current_screen_match( $services_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( $services_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_services_post_type_name',
array(
'singular' => __( 'Service', 'fw' ),
'plural' => __( 'Services', 'fw' )
) );
register_post_type( $this->post_type,
array(
'labels' => array(
'name' => $post_names['plural'], //__( 'Services', 'fw' ),
'singular_name' => $post_names['singular'], //__( 'Services service', 'fw' ),
'add_new' => __( 'Add New', 'fw' ),
'add_new_item' => sprintf( __( 'Add New %s', 'fw' ), $post_names['singular'] ),
'edit' => __( 'Edit', 'fw' ),
'edit_item' => sprintf( __( 'Edit %s', 'fw' ), $post_names['singular'] ),
'new_item' => sprintf( __( 'New %s', 'fw' ), $post_names['singular'] ),
'all_items' => sprintf( __( 'All %s', 'fw' ), $post_names['plural'] ),
'view' => sprintf( __( 'View %s', 'fw' ), $post_names['singular'] ),
'view_item' => sprintf( __( 'View %s', 'fw' ), $post_names['singular'] ),
'search_items' => sprintf( __( 'Search %s', 'fw' ), $post_names['plural'] ),
'not_found' => sprintf( __( 'No %s Found', 'fw' ), $post_names['plural'] ),
'not_found_in_trash' => sprintf( __( 'No %s Found In Trash', 'fw' ), $post_names['plural'] ),
'parent_item_colon' => '' /* text for parent types */
),
'description' => __( 'Create a services item', 'fw' ),
'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-hammer',
'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_services_category_name',
array(
'singular' => __( 'Category', 'fw' ),
'plural' => __( 'Categories', 'fw' )
) );
$labels = array(
'name' => sprintf( _x( 'Services %s', 'taxonomy general name', 'fw' ),
$category_names['plural'] ),
'singular_name' => sprintf( _x( 'Services %s', 'taxonomy singular name', 'fw' ),
$category_names['singular'] ),
'search_items' => sprintf( __( 'Search %s', 'fw' ), $category_names['plural'] ),
'all_items' => sprintf( __( 'All %s', 'fw' ), $category_names['plural'] ),
'parent_item' => sprintf( __( 'Parent %s', 'fw' ), $category_names['singular'] ),
'parent_item_colon' => sprintf( __( 'Parent %s:', 'fw' ), $category_names['singular'] ),
'edit_item' => sprintf( __( 'Edit %s', 'fw' ), $category_names['singular'] ),
'update_item' => sprintf( __( 'Update %s', 'fw' ), $category_names['singular'] ),
'add_new_item' => sprintf( __( 'Add New %s', 'fw' ), $category_names['singular'] ),
'new_item_name' => sprintf( __( 'New %s Name', 'fw' ), $category_names['singular'] ),
'menu_name' => sprintf( __( '%s', 'fw' ), $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 ) {
if ( $post_type === $this->post_type ) {
$icon_set = $this->get_config( 'icon-set' );
if( empty( $icon_set ) ) {
$icon_options = array(
'label' => false,
'type' => 'icon-v2'
);
} else {
$icon_options = array(
'label' => false,
'type' => 'icon-v2',
'set' => $this->get_config( 'icon-set' )
);
}
$options[] = array(
'icon_box' => array(
'context' => 'side',
'title' => __( 'Service', 'fw' ) . ' ' . __( 'Icon', 'fw' ),
'type' => 'box',
'options' => array(
'service_icon' => $icon_options
)
)
);
}
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_services() {
global $menu;
foreach ( $menu as $key => $menu_item ) {
if ( $menu_item[2] == 'edit.php?post_type=' . $this->post_type ) {
$menu[ $key ][0] = __( 'Services', 'fw' );
}
}
}
/**
* 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',
__( 'Single Service Image', 'fw' ),
'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', 'fw' ) ) . '">' .
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_services_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-services-category"><option value="0">' . __( 'View all categories',
'fw' ) . '</option></select>';
return;
}
$get = FW_Request::GET( $this->get_name() . '-filter-by-services-category' );
$id = ( ! empty( $get ) ) ? (int) $get : 0;
$dropdown_options = array(
'selected' => $id,
'name' => $this->get_name() . '-filter-by-services-category">',
'taxonomy' => $this->taxonomy_name,
'show_option_all' => __( 'View all categories', 'fw' ),
'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 services page
$new_columns['image'] = __( 'Feat. Image', 'fw' );
return array_merge( $new_columns, $columns );
}
/**
* @internal
*
* @param WP_Query $query
*
* @return WP_Query
*/
public function _filter_admin_filter_servicess_by_services_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-services-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;
}
}

View File

@@ -0,0 +1,8 @@
<?php if ( ! defined( 'FW' ) ) {
die( 'Forbidden' );
}
$cfg = array();
$cfg['icon-set'] = 'rt-icons-2';
$cfg['has-icon'] = true;

View File

@@ -0,0 +1,31 @@
<?php if ( ! defined( 'FW' ) ) {
die( 'Forbidden' );
}
function fw_ext_services_get_icon( $post_id = 0 ) {
if ( 0 === $post_id && null === ( $post_id = get_the_ID() ) ) {
return array();
}
return fw_get_db_post_option($post_id, 'service_icon', array());
}
function fw_ext_services_get_icon_array() {
$icon_array = fw_ext_services_get_icon();
$icon_html = '';
$icon_type = false;
if ( $icon_array['type'] === 'icon-font' ) {
if($icon_array['icon-class'] !== '') {
$icon_html = '<i class="' . $icon_array['icon-class'] . '"></i>';
$icon_type = 'icon';
}
} elseif ($icon_array['type'] === 'custom-upload') {
$icon_html = '<img src="' . $icon_array['url'] . '" alt="">';
$icon_type = 'image';
}
return array(
'icon_html' => $icon_html,
'icon_type' => $icon_type,
);
}

View File

@@ -0,0 +1,64 @@
<?php if ( ! defined( 'FW' ) ) {
die( 'Forbidden' );
}
/**
* Replace the content of the current template with the content of services view
*
* @param string $the_content
*
* @return string
*/
function _filter_fw_ext_services_the_content( $the_content ) {
/**
* @var FW_Extension_Services $services
*/
$services = fw()->extensions->get( 'services' );
return fw_render_view( $services->locate_view_path( 'content' ), array( 'the_content' => $the_content ) );
}
/**
* Check if the there are defined views for the services templates, otherwise are used theme templates
*
* @param string $template
*
* @return string
*/
function _filter_fw_ext_services_template_include( $template ) {
/**
* @var FW_Extension_Services $services
*/
$services = fw()->extensions->get( 'services' );
if ( is_singular( $services->get_post_type_name() ) ) {
if ( preg_match( '/single-' . '.*\.php/i', basename( $template ) ) === 1 ) {
return $template;
}
if ( $services->locate_view_path( 'single' ) ) {
return $services->locate_view_path( 'single' );
} else {
add_filter( 'the_content', '_filter_fw_ext_services_the_content' );
}
} else if ( is_tax( $services->get_taxonomy_name() ) && $services->locate_view_path( 'taxonomy' ) ) {
if ( preg_match( '/taxonomy-' . '.*\.php/i', basename( $template ) ) === 1 ) {
return $template;
}
return $services->locate_view_path( 'taxonomy' );
} else if ( is_post_type_archive( $services->get_post_type_name() ) && $services->locate_view_path( 'archive' ) ) {
if ( preg_match( '/archive-' . '.*\.php/i', basename( $template ) ) === 1 ) {
return $template;
}
return $services->locate_view_path( 'archive' );
}
return $template;
}
add_filter( 'template_include', '_filter_fw_ext_services_template_include' );

View File

@@ -0,0 +1,16 @@
<?php if ( ! defined( 'FW' ) ) {
die( 'Forbidden' );
}
$manifest = array();
$manifest['name'] = __( 'Services', 'fw' );
$manifest['description'] = __(
'This extension will add a fully fledged services module that will let you display your services'
.' using the built in services pages.',
'fw'
);
$manifest['version'] = '1.0.0';
$manifest['display'] = true;
$manifest['standalone'] = true;
$manifest['thumbnail'] = 'fa fa-university';

View File

@@ -0,0 +1,67 @@
<?php if ( ! defined( 'FW' ) ) {
die( 'Forbidden' );
}
class FW_Shortcode_Services extends FW_Shortcode {
protected function _render( $atts, $content = null, $tag = '' ) {
if ( ! isset( $atts['layout'] ) ) {
return $this->get_error_msg();
}
//get post type dynamically
$ext_services_settings = fw()->extensions->get( 'services' )->get_settings();
$post_type = $ext_services_settings['post_type'];
$taxonomy_name = $ext_services_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', 'fw' ) . '</p>';
}
}

View File

@@ -0,0 +1,11 @@
<?php if ( ! defined( 'FW' ) ) {
die( 'Forbidden' );
}
$cfg = array(
'page_builder' => array(
'title' => esc_html__( 'Services', 'fw' ),
'description' => esc_html__( 'Services various views', 'fw' ),
'tab' => esc_html__( 'Widgets', 'fw' )
)
);

View File

@@ -0,0 +1,119 @@
<?php if ( ! defined( 'FW' ) ) {
die( 'Forbidden' );
}
$ext_services_settings = fw()->extensions->get( 'services' )->get_settings();
$taxonomy = $ext_services_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', 'fw' ),
'desc' => esc_html__( 'Number of posts to display', 'fw' ),
),
'margin' => array(
'label' => esc_html__( 'Horizontal item margin (px)', 'fw' ),
'desc' => esc_html__( 'Select horizontal item margin', 'fw' ),
'value' => '30',
'type' => 'select',
'choices' => array(
'0' => esc_html__( '0', 'fw' ),
'1' => esc_html__( '1px', 'fw' ),
'2' => esc_html__( '2px', 'fw' ),
'10' => esc_html__( '10px', 'fw' ),
'30' => esc_html__( '30px', 'fw' ),
)
),
'layout' => array(
'label' => esc_html__( 'Layout', 'fw' ),
'desc' => esc_html__( 'Choose layout', 'fw' ),
'value' => 'carousel',
'type' => 'select',
'choices' => array(
'carousel' => esc_html__( 'Carousel', 'fw' ),
'isotope' => esc_html__( 'Masonry Grid', 'fw' ),
)
),
'responsive_lg' => array(
'label' => esc_html__( 'Columns on large screens', 'fw' ),
'desc' => esc_html__( 'Select items number on wide screens (>1200px)', 'fw' ),
'value' => '4',
'type' => 'select',
'choices' => array(
'1' => esc_html__( '1', 'fw' ),
'2' => esc_html__( '2', 'fw' ),
'3' => esc_html__( '3', 'fw' ),
'4' => esc_html__( '4', 'fw' ),
'6' => esc_html__( '6', 'fw' ),
)
),
'responsive_md' => array(
'label' => esc_html__( 'Columns on middle screens', 'fw' ),
'desc' => esc_html__( 'Select items number on middle screens (>992px)', 'fw' ),
'value' => '3',
'type' => 'select',
'choices' => array(
'1' => esc_html__( '1', 'fw' ),
'2' => esc_html__( '2', 'fw' ),
'3' => esc_html__( '3', 'fw' ),
'4' => esc_html__( '4', 'fw' ),
'6' => esc_html__( '6', 'fw' ),
)
),
'responsive_sm' => array(
'label' => esc_html__( 'Columns on small screens', 'fw' ),
'desc' => esc_html__( 'Select items number on small screens (>768px)', 'fw' ),
'value' => '2',
'type' => 'select',
'choices' => array(
'1' => esc_html__( '1', 'fw' ),
'2' => esc_html__( '2', 'fw' ),
'3' => esc_html__( '3', 'fw' ),
'4' => esc_html__( '4', 'fw' ),
'6' => esc_html__( '6', 'fw' ),
)
),
'responsive_xs' => array(
'label' => esc_html__( 'Columns on extra small screens', 'fw' ),
'desc' => esc_html__( 'Select items number on extra small screens (<767px)', 'fw' ),
'value' => '1',
'type' => 'select',
'choices' => array(
'1' => esc_html__( '1', 'fw' ),
'2' => esc_html__( '2', 'fw' ),
'3' => esc_html__( '3', 'fw' ),
'4' => esc_html__( '4', 'fw' ),
'6' => esc_html__( '6', 'fw' ),
)
),
'show_filters' => array(
'type' => 'switch',
'value' => false,
'label' => esc_html__( 'Show filters', 'fw' ),
'desc' => esc_html__( 'Hide or show categories filters', 'fw' ),
'left-choice' => array(
'value' => false,
'label' => esc_html__( 'No', 'fw' ),
),
'right-choice' => array(
'value' => true,
'label' => esc_html__( 'Yes', 'fw' ),
),
),
'cat' => array(
'type' => 'multi-select',
'label' => esc_html__('Select categories', 'fw'),
'desc' => esc_html__('You can select one or more categories', 'fw'),
'population' => 'taxonomy',
'source' => $taxonomy,
'prepopulate' => 10,
'limit' => 100,
)
);

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

View File

@@ -0,0 +1,48 @@
<?php if ( ! defined( 'FW' ) ) {
die( 'Forbidden' );
}
/**
* @var array $atts
* @var array $posts
*/
$unique_id = uniqid();
$categories = fw_ext_extension_get_listing_categories( $atts['cat'], 'services' );
$sort_classes = fw_ext_extension_get_sort_classes( $posts->posts, $categories, '', 'services' );
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', 'fw' ); ?></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-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( 'services' )->locate_view_path( 'loop-item' ) );
?>
</div>
<?php endwhile; ?>
<?php wp_reset_postdata(); // reset the query ?>
</div>

View File

@@ -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'], 'services' );
$sort_classes = fw_ext_extension_get_sort_classes( $posts->posts, $categories, '', 'services' );
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', 'fw' ); ?></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"
<?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( 'services' )->locate_view_path( 'loop-item' ) );
?>
</div>
<?php endwhile; ?>
<?php wp_reset_postdata(); // reset the query ?>
</div><!-- eof .isotope_container -->
</div><!-- eof .columns_padding_* -->

View File

@@ -0,0 +1,69 @@
<?php if ( ! defined( 'FW' ) ) {
die( 'Forbidden' );
}
/**
* Shortcode Posts - extended item layout
*/
$terms = get_the_terms( get_the_ID(), 'category' );
$filter_classes = '';
foreach ( $terms as $term ) {
$filter_classes .= ' filter-' . $term->slug;
}
?>
<article <?php post_class( "vertical-item content-padding with_background text-center" . $filter_classes ); ?>>
<?php if ( get_the_post_thumbnail() ) : ?>
<div class="item-media">
<?php
echo get_the_post_thumbnail();
?>
<div class="media-links">
<a class="abs-link" href="<?php the_permalink(); ?>"></a>
</div>
</div>
<?php endif; //eof thumbnail check ?>
<div class="item-content">
<h3 class="item-title">
<a href="<?php the_permalink(); ?>">
<?php the_title(); ?>
</a>
</h3>
<?php solar_posted_on() ?>
<?php if ( get_the_term_list( get_the_ID(), 'category', '', ' ', '' ) ) : ?>
<div class="theme_buttons small_buttons color1">
<?php
echo get_the_term_list( get_the_ID(), 'category', '', ' ', '' );
?>
</div>
<?php endif; //terms check ?>
<?php echo the_excerpt(); ?>
</div>
<div class="item-icons greylinks">
<div>
<i class="rt-icon2-eye highlight"></i>
<?php
solar_show_post_views_count();
?>
</div>
<?php
// Set up and print post meta information.
if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) :
?>
<div>
<span class="comments-link">
<i class="rt-icon2-bubble highlight"></i>
<?php comments_popup_link( esc_html__( '0', 'solar' ), esc_html__( '1', 'solar' ), esc_html__( '%', 'solar' ) ); ?>
</span>
</div>
<?php
endif; //password
?>
<div>
<i class="rt-icon2-like highlight"></i>
<?php
solar_post_like_button( get_the_ID() );
solar_post_like_count( get_the_ID() );
?>
</div>
</div>
</article><!-- eof vertical-item -->

View File

@@ -0,0 +1,49 @@
<?php if ( ! defined( 'FW' ) ) {
die( 'Forbidden' );
}
/**
* Shortcode Posts - regular item layout
*/
//has thumbnail layout
if ( get_the_post_thumbnail() ) :
?>
<article <?php post_class( 'vertical-item gallery-item content-absolute text-center cs' ) ?>">
<div class="item-media">
<?php
$full_image_src = wp_get_attachment_url( get_post_thumbnail_id( get_the_ID() ) );
echo get_the_post_thumbnail();
?>
<div class="media-links">
<div class="links-wrap">
<a class="p-view prettyPhoto " title=""
data-gal="prettyPhoto[gal-<?php echo esc_attr( $unique_id ); ?>]"
href="<?php echo esc_attr( $full_image_src ); ?>"></a>
<a class="p-link" title="" href="<?php the_permalink(); ?>"></a>
</div>
</div>
</div>
<div class="item-content">
<h4 class="item-meta">
<a href="<?php the_permalink(); ?>">
<?php the_title(); ?>
</a>
</h4>
</div>
</article>
<?php
//no featured image
else :
?>
<article <?php post_class( 'vertical-item gallery-item item-no-image text-center display_table' ) ?>">
<div class="item-content display_table_cell">
<h4 class="item-meta">
<a href="<?php the_permalink(); ?>">
<?php the_title(); ?>
</a>
</h4>
</div>
</article>
<?php
endif;
?>

View File

@@ -0,0 +1,47 @@
<?php if ( ! defined( 'FW' ) ) {
die( 'Forbidden' );
}
/**
* Shortcode Posts - title item layout
*/
$terms = get_the_terms( get_the_ID(), 'category' );
$filter_classes = '';
foreach ( $terms as $term ) {
$filter_classes .= ' filter-' . $term->slug;
}
//wrapping in div for carousel layout
?>
<article class="widget_blog-post-item <?php echo esc_attr( $filter_classes ); ?>">
<div <?php post_class( "vertical-item gallery-title-item" ); ?>>
<?php if ( get_the_post_thumbnail() ) : ?>
<div class="item-media">
<?php
$full_image_src = wp_get_attachment_url( get_post_thumbnail_id( get_the_ID() ) );
echo get_the_post_thumbnail();
?>
<div class="media-links">
<div class="links-wrap">
<a class="p-view prettyPhoto " title=""
data-gal="prettyPhoto[gal-<?php echo esc_attr( $unique_id ); ?>]"
href="<?php echo esc_attr( $full_image_src ); ?>"></a>
<a class="p-link" title="" href="<?php the_permalink(); ?>"></a>
</div>
</div>
</div>
<?php endif; //eof thumbnail check ?>
</div>
<div class="item-title text-center">
<h3>
<a href="<?php the_permalink(); ?>">
<?php the_title(); ?>
</a>
</h3>
<div class="theme_buttons small_buttons color1">
<?php
echo get_the_term_list( get_the_ID(), 'category', '', ' ', '' );
?>
</div>
</div><!-- eof vertical-item -->
</article><!-- eof blog-post-item -->

View File

@@ -0,0 +1,16 @@
<?php if ( ! defined( 'FW' ) ) {
die( 'Forbidden' );
}
if ( ! is_admin() ) {
/**
* @var FW_Extension_Services $services
*/
$services = fw()->extensions->get( 'services' );
//put your addition static assets here
}

View File

@@ -0,0 +1,4 @@
#fw-options-box-icon_box.service-icon-postbox .inside {
margin-top: 0 !important;
padding-bottom: 0 !important;
}

View File

@@ -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

View File

@@ -0,0 +1 @@
jQuery('#fw-backend-option-fw-option-service_icon').closest('.postbox').addClass('service-icon-postbox');

View File

@@ -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_services_settings = fw()->extensions->get( 'services' )->get_settings();
$taxonomy_name = $ext_services_settings['taxonomy_name'];
$categories = fw_ext_extension_get_listing_categories( array(), 'services' );
global $wp_query;
$sort_classes = fw_ext_extension_get_sort_classes( $wp_query->posts, $categories, '', 'services' );
$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', 'fw' ); ?></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( 'services' )->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();

View File

@@ -0,0 +1,58 @@
<?php if ( ! defined( 'FW' ) ) {
die( 'Forbidden' );
}
/**
* Single service loop item layout
* also using as a default service view in a shortcode
*/
$ext_services_settings = fw()->extensions->get( 'services' )->get_settings();
$taxonomy_name = $ext_services_settings['taxonomy_name'];
$icon_array = fw_ext_services_get_icon_array();
?>
<?php if ( has_post_thumbnail() ) : ?>
<article class="vertical-item content-padding with_border text-center">
<div class="item-media">
<?php the_post_thumbnail(); ?>
</div>
<div class="item-content">
<h4 class="entry-title">
<a href="<?php the_permalink(); ?>">
<?php the_title(); ?>
</a>
</h4>
<div>
<?php the_excerpt(); ?>
</div>
</div>
</article>
<?php else: ?>
<div class="teaser text-center">
<?php if ( $icon_array['icon_type'] === 'image' ) : ?>
<?php echo wp_kses_post( $icon_array['icon_html']); ?>
<?php else: //icon ?>
<div class="teaser_icon black size_big border_icon">
<?php echo wp_kses_post( $icon_array['icon_html']); ?>
</div>
<?php endif; ?>
<h3>
<a href="<?php the_permalink(); ?>">
<?php the_title(); ?>
</a>
</h3>
<div class="theme_buttons small_buttons color1">
<?php
echo get_the_term_list( get_the_ID(), $taxonomy_name, '', ' ', '' );
?>
</div>
<div>
<?php the_excerpt(); ?>
</div>
</div><!-- eof .teaser -->
<?php endif; ?>

View File

@@ -0,0 +1,49 @@
<?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_services_settings = fw()->extensions->get( 'services' )->get_settings();
$taxonomy_name = $ext_services_settings['taxonomy_name'];
$image_alt = get_post_meta(get_post_thumbnail_id($pID), '_wp_attachment_image_alt', true);
?>
<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( "toppadding_5" ); ?>>
<?php if ( has_post_thumbnail()) { ?>
<img src="<?php echo get_the_post_thumbnail_url(); ?>" alt="<?php echo esc_html( $image_alt ); ?>" class="alignleft big-margin" />
<?php } ?>
<h1 class="entry-title topmargin_0">
<?php the_title(); ?>
</h1>
<?php the_content(); ?>
</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();

View File

@@ -0,0 +1,78 @@
<?php
/**
* The template for displaying services 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_services_settings = fw()->extensions->get( 'services' )->get_settings();
$taxonomy_name = $ext_services_settings['taxonomy_name'];
$categories = fw_ext_extension_get_listing_categories( array(), 'services' );
global $wp_query;
$sort_classes = fw_ext_extension_get_sort_classes( $wp_query->posts, $categories, '', 'services' );
//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', 'fw' ); ?></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( 'services' )->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();