Skip to content

Instantly share code, notes, and snippets.

View frontend-coder's full-sized avatar
💭
WordPress, layout templates, smile and wine

frontend-coder frontend-coder

💭
WordPress, layout templates, smile and wine
View GitHub Profile
@frontend-coder
frontend-coder / footer.php
Last active July 13, 2022 18:14
13. Реестрація сайдбарів та вивід віджетів #wordpress
@frontend-coder
frontend-coder / header.php
Created May 29, 2022 18:16
12. bloginfo та інше #wordpress
<html <?php language_attributes(); ?> >
<meta charset="<?php bloginfo('charset'); ?>">
<?php bloginfo('name'); ?>
@frontend-coder
frontend-coder / archive.php
Created May 29, 2022 11:05
10. Вивести назву, опис категорий, кастомних типів записів #wordpress
<h1> <?php the_archive_title(); ?> </h1>
<?php the_archive_description('<div class="the-custom-class">','</div>') ?>
@frontend-coder
frontend-coder / content-video.php
Last active May 29, 2022 09:56
7. Створення форматів записів WP #wordpress
<?php
$content = apply_filters('the_content', get_the_content() );
echo get_media_embedded_in_content( $content, video );
?>
@frontend-coder
frontend-coder / functions.php
Last active July 15, 2022 15:34
6. Підтримка мініатюр #wordpress
add_theme_support('post-thumbnails');
function front_thumbnail() {
add_theme_support('post-thumbnails');
}
add_action('after_setup_theme','front_thumbnail');
add_image_size('mini', 200, 200, true);
add_image_size('mini', 200, 200, array(left,top));
@frontend-coder
frontend-coder / index.php
Last active May 26, 2022 12:46
5. Як вивести дату поста #wordpress
<?php the_time(); ?>
<?php the_time('j M Y'); ?>
human_time_diff();
$time_diff = human_time_diff( get_post_time('U'), current_time('timestamp') );
echo "Опубликовано $time_diff назад.";
//> Опубликовано 5 лет назад.
@frontend-coder
frontend-coder / index.php
Last active May 20, 2022 15:28
4. Як вивести окреме посилання на сторінку поста #wordpress
<a href="<?php permalink(); ?>" >Читати</a>
<a target="_blank" href="twitter.com/share?url=<?php the_permalink(); ?>" class="share-facebook">Link</a>
global $post;
<?php echo get_permalink($post->ID);?>
@frontend-coder
frontend-coder / exerpt.php
Last active May 20, 2022 15:13
3. Як вивести контент на сторінки рубрик чи дефолтну сторінку блога #wordpress
<?php the_excerpt(); ?>
add_filter( 'excerpt_more', 'new_excerpt_more' );
function new_excerpt_more( $more ){
global $post;
return '<a href="'. get_permalink($post) . '">Читать дальше...</a>';
}
add_filter( 'excerpt_length', function(){
return 20;
@frontend-coder
frontend-coder / functions.php
Last active May 20, 2022 14:32
0.Распечатка масивів, що використовується в wordpress темі #wordpress
function test_debug($data){
echo '<pre>' . print_r( $data, 1 ) . '</pre>';
}
test_debug(wp_get_theme());
test_debug(wp_get_theme() -> get('Version'));
vscode-fish-text
Auto Close Tag
Auto Complete Tag
Auto Rename Tag
js-beautify for VS Code
Better Align
Better Comments
Bookmarks
Cobalt2 Theme for VS Code
vscode-ext-color-highlight