Skip to content

Commit

Permalink
Version 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Micemade committed Nov 28, 2022
1 parent 07daa99 commit 9880bc2
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 85 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ Time will tell. When we estimate plugin has enough added functionalities to Elem
* Dynamic creation of plugin CSS to wp-content/uploads dir, upon activation or breakpoints change.
* Lot of small fixes and tweaks.
* Removed commented and reduntant code.
* Fixed issues with custom post types for mega menus and footer.

*** v.0.9.1 ***
* Replaced 'get_render_attribute_string' method with 'print_render_attribute_string' for escaping issues.
Expand Down
22 changes: 2 additions & 20 deletions includes/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ function get_cpt_taxonomies( $post_type ) {
* @param string $size - registered image size.
* @return $sizes
* create array of all registered image sizes.
* dependency - function micemade_title_slug().
*/
function micemade_elements_image_sizes_arr( $size = '' ) {

Expand All @@ -149,31 +148,14 @@ function micemade_elements_image_sizes_arr( $size = '' ) {

foreach ( $sizes_arr as $size ) {

$title = micemade_title_slug( $size );
$title = sanitize_title( $size );
$sizes[ $size ] = $title;
}

return $sizes;
}
add_filter( 'micemade_elements_image_sizes', 'micemade_elements_image_sizes_arr', 10, 1 );

if ( ! function_exists( 'micemade_title_slug' ) ) {
/**
* Title from slug
*
* @param string $slug - slug string.
* @return $title
*/
function micemade_title_slug( $slug ) {

$title = ucfirst( $slug );
$title = str_replace( '_', ' ', $title );
$title = str_replace( '-', ' ', $title );

return $title;
}
}

/**
* GET LIST OF REVOLUTION SLIDERS
*
Expand All @@ -193,7 +175,7 @@ function micemade_elements_rev_sliders_f() {
if ( ! empty( $arr_sliders ) ) {

foreach ( $arr_sliders as $id => $alias ) {
$slider_arr[ $alias ] = micemade_title_slug( $alias );
$slider_arr[ $alias ] = sanitize_title( $alias );
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions includes/class-micemade-elements.php
Original file line number Diff line number Diff line change
Expand Up @@ -420,14 +420,14 @@ public function micemade_elements_styles() {

$upload_dir = wp_upload_dir();
$style_filepath = $upload_dir['basedir'] . '/micemade-elements.css';
if ( NEW_CSS && file_exists( $style_filepath ) ) {
if ( file_exists( $style_filepath ) ) {
$url = $upload_dir['baseurl'] . '/micemade-elements.css';
} else {
$url = MICEMADE_ELEMENTS_URL . 'assets/css/micemade-elements' . $prefix . '.css';
}

// CSS styles.
wp_register_style( 'micemade-elements', $url , array(), MICEMADE_ELEMENTS_VERSION );
wp_register_style( 'micemade-elements', $url, array(), MICEMADE_ELEMENTS_VERSION );
wp_enqueue_style( 'micemade-elements' );
}

Expand Down
69 changes: 16 additions & 53 deletions includes/cpt.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}

// MM Mega menu CPT.
$mmmega_menu_labels = array(
$micemade_elements_mega_menu_labels = array(
'name' => __( 'Mega Menus', 'micemade-elements' ),
'singular_name' => __( 'Mega Menu', 'micemade-elements' ),
'add_new' => __( 'New Mega Menu', 'micemade-elements' ),
Expand All @@ -24,8 +24,8 @@
'not_found' => __( 'No Mega Menus Found', 'micemade-elements' ),
'not_found_in_trash' => __( 'No Mega Menus found in Trash', 'micemade-elements' ),
);
$mmmega_menu_args = array(
'labels' => $mmmega_menu_labels,
$micemade_elements_mega_menu_args = array(
'labels' => $micemade_elements_mega_menu_labels,
'supports' => array( 'title' ),
'public' => true,
'rewrite' => false,
Expand All @@ -37,40 +37,10 @@
'hierarchical' => false,
'menu_icon' => 'dashicons-menu',
);
register_post_type( 'MM Mega menu', $mmmega_menu_args );
register_post_type( 'mmmegamenu', $micemade_elements_mega_menu_args );

// MM Header CPT
// - postponed for 1.0.0
/*
$mm_header_labels = array(
'name' => __( 'Headers', 'micemade-elements' ),
'singular_name' => __( 'Header', 'micemade-elements' ),
'add_new' => __( 'New Header', 'micemade-elements' ),
'add_new_item' => __( 'Add New Header', 'micemade-elements' ),
'edit_item' => __( 'Edit Header', 'micemade-elements' ),
'new_item' => __( 'New Header', 'micemade-elements' ),
'view_item' => __( 'View Header', 'micemade-elements' ),
'search_items' => __( 'Search Headers', 'micemade-elements' ),
'not_found' => __( 'No Headers Found', 'micemade-elements' ),
'not_found_in_trash' => __( 'No Headers found in Trash', 'micemade-elements' ),
);
$mm_header_args = array(
'labels' => $mm_header_labels,
'supports' => array( 'title' ),
'public' => true,
'rewrite' => false,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => false,
'exclude_from_search' => true,
'capability_type' => 'post',
'hierarchical' => false,
'menu_icon' => 'dashicons-layout',
);
register_post_type( 'MM Header', $mm_header_args );
*/
// MM Footer CPT.
$mm_footer_labels = array(
$micemade_elements_footer_labels = array(
'name' => __( 'Footers', 'micemade-elements' ),
'singular_name' => __( 'Footer', 'micemade-elements' ),
'add_new' => __( 'New Footer', 'micemade-elements' ),
Expand All @@ -82,8 +52,8 @@
'not_found' => __( 'No Footers Found', 'micemade-elements' ),
'not_found_in_trash' => __( 'No Footers found in Trash', 'micemade-elements' ),
);
$mm_footer_args = array(
'labels' => $mm_footer_labels,
$micemade_elements_footer_args = array(
'labels' => $micemade_elements_footer_labels,
'supports' => array( 'title' ),
'public' => true,
'rewrite' => false,
Expand All @@ -95,26 +65,19 @@
'hierarchical' => false,
'menu_icon' => 'dashicons-layout',
);
register_post_type( 'MM Footer', $mm_footer_args );

register_post_type( 'mmfooter', $micemade_elements_footer_args );

// Automatically activate Elementor support for MM Mega menu CPT (always active).
$elementor_cpt_support = get_option( 'elementor_cpt_support', [ 'page', 'post' ] );
if ( ! in_array( 'mmmegamenu', $elementor_cpt_support ) ) {
$elementor_cpt_support[] = 'mmmegamenu';
update_option( 'elementor_cpt_support', $elementor_cpt_support );
}
/* // Postponed for 1.0.0
if ( ! in_array( 'mmheader', $elementor_cpt_support ) ) {
$elementor_cpt_support[] = 'mmheader';
update_option( 'elementor_cpt_support', $elementor_cpt_support );
$micemade_elements_elementor_cpt_support = get_option( 'elementor_cpt_support', [ 'page', 'post' ] );
if ( ! in_array( 'mmmegamenu', $micemade_elements_elementor_cpt_support ) ) {
$micemade_elements_elementor_cpt_support[] = 'mmmegamenu';
update_option( 'elementor_cpt_support', $micemade_elements_elementor_cpt_support );
}
*/
if ( ! in_array( 'mmfooter', $elementor_cpt_support ) ) {
$elementor_cpt_support[] = 'mmfooter';
update_option( 'elementor_cpt_support', $elementor_cpt_support );

if ( ! in_array( 'mmfooter', $micemade_elements_elementor_cpt_support ) ) {
$micemade_elements_elementor_cpt_support[] = 'mmfooter';
update_option( 'elementor_cpt_support', $micemade_elements_elementor_cpt_support );
}

add_filter( 'mm_megamenu_cpt', '__return_true' );
//add_filter( 'mm_header_cpt', '__return_true' ); // for 1.0.0
add_filter( 'mm_footer_cpt', '__return_true' );
14 changes: 9 additions & 5 deletions includes/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,11 @@ function micemade_elements_posted_in( $taxonomy ) {
/**
* Date for post meta function
*
* @param string $date - a string with a date.
*
* @return void
*/
function micemade_elements_date( $void ) {
function micemade_elements_date( $date ) {

$date = '<span class="published"><time datetime="' . sprintf( get_the_time( esc_html__( 'Y-m-d', 'micemade-elements' ) ) ) . '">' . sprintf( get_the_time( get_option( 'date_format', 'M d, Y' ) ) ) . '</time></span>';

Expand All @@ -147,9 +149,11 @@ function micemade_elements_date( $void ) {
/**
* Author for post meta
*
* @param string $author - a string with author.
*
* @return void
*/
function micemade_elements_author( $void ) {
function micemade_elements_author( $author ) {
$author = '<span class="author vcard"><span class="by">' . esc_html__( 'By: ', 'micemade-elements' ) . '</span><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '" title="' . esc_attr( get_the_author_meta( 'display_name' ) ) . '">' . esc_html( get_the_author_meta( 'display_name' ) ) . '</a></span>';

echo wp_kses_post( $author );
Expand Down Expand Up @@ -277,7 +281,7 @@ function micemade_elements_thumb_back_f( $img_format = 'thumbnail', $attach_id =

$img_url = '';

if ( has_post_thumbnail() || $attach_id ) {
if ( has_post_thumbnail() || $attach_id ) {

$att_src = wp_get_attachment_image_src( $attach_id, $img_format );
$img_url = $att_src[0];
Expand Down Expand Up @@ -428,9 +432,9 @@ function micemade_elements_loop_post_func( $style = 'style_1', $grid = '', $show
if ( $show_thumb ) {

if ( 'style_3' === $style || 'style_4' === $style ) {
do_action( 'micemade_elements_thumb_back', $img_format );
do_action( 'micemade_elements_thumb_back', $img_format, get_post_thumbnail_id(), get_permalink() );
} else {
do_action( 'micemade_elements_thumb', $img_format );
do_action( 'micemade_elements_thumb', $img_format, get_post_thumbnail_id(), get_permalink() );
}
}
?>
Expand Down
6 changes: 1 addition & 5 deletions micemade-elements.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Author: micemade
* Author URI: http://micemade.com
* Text Domain: micemade-elements
* Elementor tested up to: 3.6.4
* Elementor tested up to: 3.8.1
* Elementor Pro tested up to: 3.1.0
*
* @package WordPress
Expand Down Expand Up @@ -48,8 +48,4 @@
define( 'MICEMADE_ELEMENTS_SLUG', plugin_basename( __FILE__ ) );
}

if ( ! defined( 'NEW_CSS' ) ) {
define( 'NEW_CSS', false );
}

require_once MICEMADE_ELEMENTS_INCLUDES . 'class-micemade-elements.php';

0 comments on commit 9880bc2

Please sign in to comment.