notes
sidebar
register_sidebar( array( 'name' => 'abc', 'id' => 'xyz', 'before_widget' => '<div>', 'after_widget' => '</div> <!-- end .fwidget -->', 'before_title' => '<h4 class="widgettitle">', 'after_title' => '</h4>', ) );
<?php get_sidebar( 'xyz' ); ?>
<?php dynamic_sidebar( 'xyz' ); ?>
klasa diva od kategorii
<div class="<?php foreach(get_the_category() as $category) {echo $category->slug . ' ';}?>">m</div>
menu
function register_my_menu() {
register_nav_menu('new-menu',__( 'New Menu' ));
}
add_action( 'init', 'register_my_menu' );
<?php wp_nav_menu( array( 'theme_location' => 'new-menu' ) ); ?>
child theme
Theme Name: name-child
Template: name
@import url("../name/style.css");
footer
© <a href="/" title="<?php echo esc_attr( get_bloginfo( 'name' ) ); ?>"> <?php echo esc_attr( get_bloginfo( 'name' ) ); ?> </a>
footer
<?php echo date("Y"); ?>
<?php echo get_the_date(); ?>
pokaż tylko na stronie id:5234
<?php
if(is_page(5234)){
?>
<?php dynamic_sidebar( 'xyz' ); ?>
<?php }
else {
echo '';
}
?>
pokaż tylko w danym języku
<?php if(ICL_LANGUAGE_CODE=='pl'): ?> <a href="/ciasteczka">Ciasteczka</a> <?php elseif(ICL_LANGUAGE_CODE=='en'): ?> <a href="/en/cookies">Cookies</a> <?php endif; ?>
dodanie nowych wyrażeń do tłumaczenia poprzez polylang
pll_register_string('title', 'O Autorze');
<h2><?php pll_e("O Autorze", "templaty"); ?></h2>
wyświetlaj na stronie głównej
<?php if ( is_front_page() ) { ?>
text here
<?php } else { ?>
text here
<?php } ?>
add_post_type_support( 'page', 'excerpt' );
function custom_excerpt_length( $length ) {
return 20;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
function new_excerpt_more( $more ) {
return '...';
}
add_filter('excerpt_more', 'new_excerpt_more');
pll_register_string('title', 'Czytaj dalej');
add_image_size( 'isat-thumb', 770, 9999 );
function themeslug_theme_customizer( $wp_customize ) {
$wp_customize->add_section( 'themeslug_logo_section' , array(
'title' => __( 'Logo', 'themeslug' ),
'priority' => 30,
'description' => 'Upload a logo to replace the default site name and description in the header',
) );
$wp_customize->add_setting( 'themeslug_logo' );
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'themeslug_logo', array(
'label' => __( 'Logo', 'themeslug' ),
'section' => 'themeslug_logo_section',
'settings' => 'themeslug_logo',
) ) );
}
add_action( 'customize_register', 'themeslug_theme_customizer' );
https://kwight.ca/2012/12/02/adding-a-logo-uploader-to-your-wordpress-site-with-the-theme-customizer/
http://scottbolinger.com/add-a-custom-logo-uploader-to-the-wordpress-theme-customizer/
add_theme_support( 'post-thumbnails' );
<?php
// check if the post has a Post Thumbnail assigned to it.
if ( has_post_thumbnail() ) {
the_post_thumbnail();
}
the_content();
?>
<article class="post <?php global $post; echo $post->post_name; ?>">
.gray {
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /* Firefox 10+, Firefox on Android */
filter: gray; /* IE6-9 */
-webkit-filter: grayscale(100%); /* Chrome 19+, Safari 6+, Safari 6+ iOS */
}
.gray:hover {
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'1 0 0 0 0, 0 1 0 0 0, 0 0 1 0 0, 0 0 0 1 0\'/></filter></svg>#grayscale");
-webkit-filter: grayscale(0%);
}
<article class="post" <?php
if ( $thumbnail_id = get_post_thumbnail_id() ) {
if ( $image_src = wp_get_attachment_image_src( $thumbnail_id, 'medium' ) )
printf( ' style="background-image: url(%s);"', $image_src[0] );
}
?>>