Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
2df4305
back to top button
RachelRVasquez Mar 20, 2026
fd6e0c0
move the back to top function to the customizer.php file
RachelRVasquez Mar 25, 2026
5076d24
in the process of bringing over pieces from the original footer-custo…
RachelRVasquez Mar 26, 2026
51fcf22
putting document setting to override footer on pages, updated the foo…
RachelRVasquez Mar 27, 2026
f71df4d
detecting post meta override, needs testing
RachelRVasquez Mar 27, 2026
0cf0ec7
legacy footer should properly act as a fallback, post meta override w…
RachelRVasquez Mar 27, 2026
35dd48b
fixes from co-pilot review
RachelRVasquez Mar 27, 2026
e7e836e
new pattern for the footer using the icon block from WP 7.0
RachelRVasquez Apr 3, 2026
9f03241
remove spaces
RachelRVasquez Apr 3, 2026
53842d6
fixes based on Flint's feedback
RachelRVasquez Apr 3, 2026
a9c7d47
tweak backgrounds on some html elements so they're consistent (bg, bl…
RachelRVasquez Apr 6, 2026
9d3d449
adjust background and text colors on footer pattern 1 and 3 so it's a…
RachelRVasquez Apr 6, 2026
7225956
mobile tweaks to patterns
RachelRVasquez Apr 6, 2026
569fd78
Fix for when a footer post that was selected in theme mods has been d…
RachelRVasquez Apr 6, 2026
e9aff49
ensure patterns only show in inserter for footer cpt
RachelRVasquez Apr 6, 2026
3e3d90a
add comment clarifying override post meta default, should be 0, comes…
RachelRVasquez Apr 7, 2026
264be03
Removing need for the footer widgets cols theme mod; handle for fallb…
kimcoleman Apr 7, 2026
5779884
Moving legacy settings below variation settings (hopefully we remove …
kimcoleman Apr 7, 2026
c48876c
Plain list block style; do_shortcode on footer content; updating exis…
kimcoleman Apr 8, 2026
dec81b1
More plain "default" footer-01. Adding footer edit link. legacy copyr…
kimcoleman Apr 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions css/customizer.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
padding: 10px;
}

.section-meta + li .customize-control-title.settings-heading {
border-top: 0;
margin-top: 0;
padding-top: 0;
}

.customize-control-description {
margin-bottom: 10px;
}
Expand Down
21 changes: 18 additions & 3 deletions footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,27 @@

<?php
if ( ! memberlite_hide_page_footer() ) {
$footer_variation = sanitize_key( memberlite_get_variation( 'footer' ) );
$footer_class = 'site-footer site-footer-' . $footer_variation;
//New Footer Pattern Method
$footer_post_name = memberlite_get_current_footer_post_name();
$footer_class = 'site-footer';
$footer_post_name_exists = ! empty( $footer_post_name ) && '0' !== $footer_post_name;

if ( $footer_post_name_exists ) {
$footer_class .= ' site-footer-' . sanitize_html_class( $footer_post_name );
} else {
$footer_class .= ' site-footer-default'; //legacy footer
}
?>
<footer id="colophon" class="<?php echo esc_attr( $footer_class ); ?>" role="contentinfo">
<?php get_template_part( 'components/footer/variation', $footer_variation ); ?>
<?php
if ( $footer_post_name_exists ) {
memberlite_render_footer_variation( $footer_post_name );
} else {
get_template_part( 'components/footer/variation', 'default' ); //legacy footer
}
?>
</footer><!-- #colophon -->
<?php memberlite_the_footer_edit_link( $footer_post_name ); ?>
<?php
}
?>
Expand Down
46 changes: 34 additions & 12 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -375,22 +375,11 @@ function memberlite_widgets_init() {
)
);

$footer_widgets_count = get_theme_mod( 'memberlite_footerwidgets', $memberlite_defaults['memberlite_footerwidgets'] );
if ( $footer_widgets_count == '2' ) {
$footer_widgets_col_class = 'medium-6';
} elseif ( $footer_widgets_count == '3' ) {
$footer_widgets_col_class = 'medium-4';
} elseif ( $footer_widgets_count == '6' ) {
$footer_widgets_col_class = 'large-3';
} else {
$footer_widgets_col_class = 'medium-3';
}
register_sidebar(
array(
'name' => __( 'Footer Widgets', 'memberlite' ),
'id' => 'sidebar-4',
'description' => 'You can set the number of widget columns in Appearance > Customize. Default: 4 columns.',
'before_widget' => '<aside id="%1$s" class="widget ' . $footer_widgets_col_class . ' columns %2$s">',
'before_widget' => '<aside id="%1$s" class="widget medium-3 columns %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
Expand All @@ -410,6 +399,36 @@ function memberlite_widgets_init() {
}
add_action( 'widgets_init', 'memberlite_widgets_init' );

/**
* Dynamically assign column width classes to footer widgets based on how many
* are active, spacing them evenly at no less than 25% width (max 4 per row).
*
* @since TBD
*/
function memberlite_footer_widget_col_class( array $params ): array {
if ( 'sidebar-4' !== $params[0]['id'] ) {
return $params;
}

$sidebars = wp_get_sidebars_widgets();
$count = count( $sidebars['sidebar-4'] ?? array() );

if ( $count <= 1 ) {
$col_class = 'medium-12';
} elseif ( $count === 2 ) {
$col_class = 'medium-6';
} elseif ( $count === 3 ) {
$col_class = 'medium-4';
} else {
$col_class = 'medium-3';
}

$params[0]['before_widget'] = str_replace( 'medium-3', $col_class, $params[0]['before_widget'] );

return $params;
}
add_filter( 'dynamic_sidebar_params', 'memberlite_footer_widget_col_class' );

/* Get the redirect_to URL to use for "Log In" links. */
function memberlite_login_redirect_to() {
if ( isset( $_SERVER['REQUEST_URI'] ) ) {
Expand Down Expand Up @@ -582,6 +601,9 @@ function memberlite_get_sidebar( $name = null ) {
/* Editor Settings */
require_once get_template_directory() . '/inc/editor-settings.php';

/* Block Styles */
require_once get_template_directory() . '/inc/block-styles.php';

/* Custom sidebars. */
require_once get_template_directory() . '/inc/sidebars.php';
require_once get_template_directory() . '/adminpages/sidebars.php';
Expand Down
32 changes: 32 additions & 0 deletions inc/block-styles.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
/**
* Register custom block styles for Memberlite
*
* @package Memberlite
*
* @since 7.0
*/

/**
* Register block styles.
*
* @since 7.0
* @return void
*/
function memberlite_register_block_styles(): void {
register_block_style(
'core/list',
array(
'name' => 'plain',
'label' => __( 'Plain', 'memberlite' ),
'inline_style' => '
.wp-block-list.is-style-plain {
list-style: none;
padding-left: 0;
margin-left: 0;
}
',
)
);
}
add_action( 'init', 'memberlite_register_block_styles' );
109 changes: 108 additions & 1 deletion inc/customizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -409,11 +409,63 @@ public static function set_customizer_header_settings( WP_Customize_Manager $wp_
* @return void
*/
public static function set_customizer_footer_settings( WP_Customize_Manager $wp_customize ) {
// FOOTER: Pattern Footer Heading ========
self::add_memberlite_heading( $wp_customize, 'memberlite_pattern_footer_heading', __( 'Variation Settings', 'memberlite' ), 'memberlite_footer_options' );

// FOOTER: Manage Footers link ========
self::add_memberlite_link_control( $wp_customize, 'memberlite_manage_footers_link', __( 'Manage Footers', 'memberlite' ), 'memberlite_footer_options', admin_url( 'edit.php?post_type=memberlite_footer' ) );

// FOOTER: Footer CPT choices ===================
$footer_choices_default = memberlite_get_footer_variations();
$footer_choices_context = memberlite_get_footer_variations( __( '— Use Default Footer —', 'memberlite' ) );

// FOOTER: Variations, Global ===============
self::add_memberlite_setting_control( $wp_customize, 'memberlite_default_footer_slug', __( 'Default Footer', 'memberlite' ), 'memberlite_footer_options', array(
'type' => 'select',
'sanitize_callback' => 'sanitize_key',
'choices' => $footer_choices_default,
'default' => '0',
'description' => __( 'Choose which footer pattern to display all across the site.', 'memberlite' ),
) );

// FOOTER: Variations, Blog & Archives ===============
self::add_memberlite_setting_control( $wp_customize, 'memberlite_archives_footer_slug', __( 'Blog & Archives Footer', 'memberlite' ), 'memberlite_footer_options', array(
'type' => 'select',
'sanitize_callback' => 'sanitize_key',
'choices' => $footer_choices_context,
'default' => '0',
'description' => __( 'Choose which footer pattern to display on your blog and post archives.', 'memberlite' ),
) );

// FOOTER: Variations, Single Post ===============
self::add_memberlite_setting_control( $wp_customize, 'memberlite_post_footer_slug', __( 'Single Post Footer', 'memberlite' ), 'memberlite_footer_options', array(
'type' => 'select',
'sanitize_callback' => 'sanitize_key',
'choices' => $footer_choices_context,
'default' => '0',
'description' => __( 'Choose which footer pattern to display on the single post view.', 'memberlite' ),
) );

// FOOTER: Variations, Pages ===============
self::add_memberlite_setting_control( $wp_customize, 'memberlite_page_footer_slug', __( 'Pages Footer', 'memberlite' ), 'memberlite_footer_options', array(
'type' => 'select',
'sanitize_callback' => 'sanitize_key',
'choices' => $footer_choices_context,
'default' => '0',
'description' => __( 'Choose which footer pattern to display on your pages.', 'memberlite' ),
) );

// FOOTER: Legacy Footer Heading ========
self::add_memberlite_heading( $wp_customize, 'memberlite_legacy_footer_heading', __( 'Legacy Settings', 'memberlite' ), 'memberlite_footer_options', array(
'active_callback' => 'memberlite_is_legacy_footer_active',
) );

// FOOTER: Copyright Text ===============
self::add_memberlite_setting_control( $wp_customize, 'copyright_textbox', __( 'Copyright Text', 'memberlite' ), 'memberlite_footer_options', array(
'transport' => 'postMessage',
'sanitize_callback' => array( 'Memberlite_Customize', 'sanitize_text_with_links' ),
'sanitize_js_callback' => array( 'Memberlite_Customize', 'sanitize_js_text_with_links' ),
'active_callback' => 'memberlite_is_legacy_footer_active',
) );
}

Expand Down Expand Up @@ -577,14 +629,51 @@ public static function add_memberlite_heading( WP_Customize_Manager $wp_customiz
'sanitize_callback' => 'sanitize_text_field',
)
);
$control_args = array(
'label' => $label,
'section' => $section,
'priority' => $args['priority'] ?? 10,
);
if ( ! empty( $args['active_callback'] ) ) {
$control_args['active_callback'] = $args['active_callback'];
}
$wp_customize->add_control(
new Memberlite_Customize_Header_Control(
$wp_customize,
$id,
$control_args
)
);
}

/**
* Helper to add a link control (no setting, just a rendered anchor)
*
* @since 7.0
*
* @param WP_Customize_Manager $wp_customize
* @param string $id
* @param string $label
* @param string $section
* @param string $url
*
* @return void
*/
public static function add_memberlite_link_control( WP_Customize_Manager $wp_customize, string $id, string $label, string $section, string $url ): void {
$wp_customize->add_setting(
$id,
array(
'sanitize_callback' => 'sanitize_text_field',
)
);
$wp_customize->add_control(
new Memberlite_Customize_Link_Control(
$wp_customize,
$id,
array(
'label' => $label,
'section' => $section,
'priority'=> $args['priority'] ?? 10,
'url' => $url,
)
)
);
Expand Down Expand Up @@ -1006,6 +1095,24 @@ public function render_content() {
echo '<span class="customize-control-title settings-heading">' . esc_html( $this->label ) . '</span>';
}
}

class Memberlite_Customize_Link_Control extends WP_Customize_Control {
public $type = 'memberlite_link';
public $url = '';

public function render_content() {
echo '<a href="' . esc_url( $this->url ) . '" target="_blank" class="button button-secondary">' . esc_html( $this->label ) . '</a>';
}
}
}

/**
* Active callback: show legacy footer controls only when the default footer is set to legacy (0).
*
* @since 7.0
*/
function memberlite_is_legacy_footer_active(): bool {
return '0' === get_theme_mod( 'memberlite_default_footer_slug', '0' );
}

// Setup the Theme Customizer settings and controls...
Expand Down
1 change: 0 additions & 1 deletion inc/defaults.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ function memberlite_get_defaults(): array {
'author_block' => false,

// Footer
'memberlite_footerwidgets' => '4',
'copyright_textbox' => '&copy; !!current_year!! !!site_title!!',
'memberlite_back_to_top' => true,
'memberlite_back_to_top_style' => 'default',
Expand Down
25 changes: 21 additions & 4 deletions inc/editor-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ function memberlite_register_editor_settings_post_meta(): void {
}
) );

register_post_meta( 'page', '_memberlite_footer_override', array(
'show_in_rest' => true,
'type' => 'string',
'single' => true,
'default' => '',
'label' => __( 'Select Footer', 'memberlite' ),
'sanitize_callback' => 'sanitize_key',
'auth_callback' => function() {
return current_user_can( 'edit_posts' );
}
) );

register_post_meta( 'page', '_memberlite_hide_page_nav', array(
'show_in_rest' => true,
'single' => true,
Expand Down Expand Up @@ -76,10 +88,15 @@ function memberlite_enqueue_custom_editor_assets(): void {
true
);

// Get existing theme mods that we're moving into the settings
wp_localize_script( 'memberlite-custom-settings', 'memberlite_theme_mod_settings', array(
'showPrevNextSinglePages' => get_theme_mod( 'memberlite_page_nav', true )
) );
// Get existing theme mods, and get footer variations to populate the footer override setting
wp_localize_script(
'memberlite-custom-settings',
'memberliteEditorData',
array(
'showPrevNextSinglePages' => get_theme_mod( 'memberlite_page_nav', true ),
'footerVariations' => memberlite_get_footer_variations(),
)
);
}
add_action( 'enqueue_block_editor_assets', 'memberlite_enqueue_custom_editor_assets' );

Expand Down
Loading