Improve WordPress security (.htaccess)
# Enable .htpasswd authentication
<If "%{HTTP_HOST} != 'dev'">
AuthType Basic
AuthName "Login to dashboard"| <?php if ( have_posts() ) : query_posts('p=1'); | |
| while (have_posts()) : the_post(); ?> | |
| <?php the_title(); ?> | |
| <?php the_content(); ?> | |
| <?php the_post_thumbnail(array(100, 100)); ?> | |
| <? endwhile; endif; wp_reset_query(); ?> |
| function prefix_customizer_register( $wp_customize ) { | |
| $wp_customize->add_panel( 'panel_id', array( | |
| 'priority' => 10, | |
| 'capability' => 'edit_theme_options', | |
| 'theme_supports' => '', | |
| 'title' => __( 'Example Panel', 'textdomain' ), | |
| 'description' => __( 'Description of what this panel does.', 'textdomain' ), | |
| ) ); |
| <?php | |
| /** | |
| * Plugin name: Site Title (and Tagline) Smilies | |
| * Description: Demonstration of selective refresh in the Customizer. Selectors are targeting elements in Twenty Fifteen. | |
| * Author: Weston Ruter, XWP | |
| * Plugin URL: https://gist.github.com/westonruter/a15b99bdd07e6f4aae7a | |
| * | |
| * @package SiteTitleSmilies | |
| */ |
| add_action('customize_register', 'dco_customize_register'); | |
| function dco_customize_register($wp_customize) { | |
| //FOOTER | |
| $wp_customize->add_section('footer', array( | |
| 'title' => 'Подвал', | |
| 'priority' => 1, | |
| )); | |
| //footer text |
| $wp_customize->selective_refresh->add_partial($setting_1, array( | |
| 'selector' => '.contacts', | |
| 'render_callback' => function() use ($setting_1) { | |
| return nl2br(get_theme_mod($setting_1)); | |
| } | |
| )); |
| <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> | |
| <h1><?php the_title(); ?></h1> | |
| <?php the_content(); ?> | |
| <?php endwhile; else: ?> | |
| <p>Извините, ничего не найдено.</p> | |
| <?php endif; ?> |
| <?php | |
| // Добавить новую секцию | |
| $wp_customize->add_section('themeName_sectionName', | |
| array( | |
| 'title' => 'Название секции', | |
| 'priority' => 120, | |
| ) | |
| ); | |
| Создать настройку | |
| $wp_customize->add_setting('themeName_settingName'); |
| <?php | |
| // Нужно добавить в functions.php -> require get_template_directory() . '/inc/customizer.php'; | |
| // Функция, регистрирующая новые panel, sections и setting в Customizer | |
| function yoursitename_new_customizer_settings($wp_customize) { | |
| // Создать настройку логотипа | |
| $wp_customize->add_setting('yoursitename_logo'); | |
| // Добавить настройку логотипа в секцию "свойства сайта" | |
| $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'yoursitename_logo', |