Skip to content

Instantly share code, notes, and snippets.

<?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(); ?>
@andy-kliman
andy-kliman / customizer-controls-40
Created July 1, 2017 20:15 — forked from devinsays/customizer-controls-40
WordPress 4.0 Customizer Controls
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' ),
) );
@andy-kliman
andy-kliman / site-title-smilies.php
Created July 1, 2017 15:22 — forked from westonruter/site-title-smilies.php
Selective refresh example plugin
<?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
*/
@andy-kliman
andy-kliman / customizer.php
Created June 30, 2017 15:09
Customizer WordPress
<?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',
@andy-kliman
andy-kliman / README.md
Created June 30, 2017 14:43 — forked from nielslange/README.md
WordPress snippets

WordPress snippets

Security snippets

Improve WordPress security (.htaccess)

# Enable .htpasswd authentication
<If "%{HTTP_HOST} != 'dev'">
AuthType Basic
AuthName "Login to dashboard"
@andy-kliman
andy-kliman / genymotionwithplay.txt
Created June 15, 2016 12:34 — forked from wbroek/genymotionwithplay.txt
Genymotion with Google Play Services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
Google Apps for Android 4.4.4 (https://www.androidfilehost.com/?fid=23501681358544845 - gapps-kk-20140606-signed.zip)
Google Apps for Android 4.3 (https://www.androidfilehost.com/?fid=23060877490000124 - gapps-jb-20130813-signed.zip)