Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save gorobey/b66a8bd430c77c9a958f7623c9d12cf6 to your computer and use it in GitHub Desktop.
Save gorobey/b66a8bd430c77c9a958f7623c9d12cf6 to your computer and use it in GitHub Desktop.

Revisions

  1. @neilgee neilgee revised this gist May 13, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion text-block-customizer.php
    Original file line number Diff line number Diff line change
    @@ -40,6 +40,6 @@ function genesischild_register_theme_customizer( $wp_customize ) {

    // Sanitize text
    function sanitize_text( $text ) {
    return wp_kses( $text );
    return sanitize_text_field( $text );
    }
    }
  2. @neilgee neilgee revised this gist Apr 12, 2016. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions text-block-customizer.php
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,6 @@
    <?php

    add_action( 'customize_register', 'genesischild_register_theme_customizer' );
    /*
    * Register Our Customizer Stuff Here
    */
  3. @neilgee neilgee revised this gist Apr 10, 2016. 1 changed file with 2 additions and 17 deletions.
    19 changes: 2 additions & 17 deletions text-block-customizer.php
    Original file line number Diff line number Diff line change
    @@ -37,23 +37,8 @@ function genesischild_register_theme_customizer( $wp_customize ) {
    );


    // Sanitize text
    // Sanitize text
    function sanitize_text( $text ) {
    return wp_kses( $text );
    }
    }



    // Change the footer text
    add_filter('genesis_footer_creds_text', 'genesischild_footer_text');

    function genesischild_footer_text() {
    if( get_theme_mod( 'footer_text_block') != "" ) {
    echo get_theme_mod( 'footer_text_block');
    }
    else{
    echo 'Copyright &copy; 2016 · Genesis Sample Theme on Genesis Framework · WordPress · Log out';
    }

    }
    }
  4. @neilgee neilgee revised this gist Apr 9, 2016. 1 changed file with 21 additions and 0 deletions.
    21 changes: 21 additions & 0 deletions display-customizer-text.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    <?php

    // Change the footer text in Genesis with a back up if blank
    add_filter('genesis_footer_creds_text', 'genesischild_footer_text');

    function genesischild_footer_text() {
    if( get_theme_mod( 'footer_text_block') != "" ) {
    echo get_theme_mod( 'footer_text_block');
    }
    else{
    echo 'Copyright &copy; 2016 · Genesis Sample Theme on Genesis Framework · WordPress · Log out'; // Add you default footer text here
    }

    }

    // Regular WordPress theme just add in the footer template

    <?php if( get_theme_mod( 'footer_text_block') != "" ): ?>
    <p class="footer-text">
    <?php echo get_theme_mod( 'footer_text_block'); ?>
    </p>
  5. @neilgee neilgee created this gist Apr 9, 2016.
    59 changes: 59 additions & 0 deletions text-block-customizer.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,59 @@
    <?php

    /*
    * Register Our Customizer Stuff Here
    */
    function genesischild_register_theme_customizer( $wp_customize ) {
    // Create custom panel.
    $wp_customize->add_panel( 'text_blocks', array(
    'priority' => 500,
    'theme_supports' => '',
    'title' => __( 'Text Blocks', 'genesischild' ),
    'description' => __( 'Set editable text for certain content.', 'genesischild' ),
    ) );
    // Add Footer Text
    // Add section.
    $wp_customize->add_section( 'custom_footer_text' , array(
    'title' => __('Change Footer Text','genesischild'),
    'panel' => 'text_blocks',
    'priority' => 10
    ) );
    // Add setting
    $wp_customize->add_setting( 'footer_text_block', array(
    'default' => __( 'default text', 'genesischild' ),
    'sanitize_callback' => 'sanitize_text'
    ) );
    // Add control
    $wp_customize->add_control( new WP_Customize_Control(
    $wp_customize,
    'custom_footer_text',
    array(
    'label' => __( 'Footer Text', 'genesischild' ),
    'section' => 'custom_footer_text',
    'settings' => 'footer_text_block',
    'type' => 'text'
    )
    )
    );


    // Sanitize text
    function sanitize_text( $text ) {
    return wp_kses( $text );
    }
    }



    // Change the footer text
    add_filter('genesis_footer_creds_text', 'genesischild_footer_text');

    function genesischild_footer_text() {
    if( get_theme_mod( 'footer_text_block') != "" ) {
    echo get_theme_mod( 'footer_text_block');
    }
    else{
    echo 'Copyright &copy; 2016 · Genesis Sample Theme on Genesis Framework · WordPress · Log out';
    }

    }