Last active
May 17, 2018 18:18
-
-
Save SashaKolbasov/3e62d2e3c7dd8464c8433eb644b0a118 to your computer and use it in GitHub Desktop.
Own WordPress hooks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// page tags | |
<?php get_header(); ?> | |
<?php get_footer(); ?> | |
<?php bloginfo('template_url'); ?>/ | |
<?php /* Template Name: Index */ ?> | |
<?php get_template_part('partname'); ?> | |
<?php get_template_part('template-parts/content-post', get_post_type()); ?> | |
<?php wp_head(); ?> | |
<?php wp_footer(); ?> | |
// post gats | |
<?php the_title(); ?> | |
<?php the_permalink(); ?> | |
<?php the_content(); ?> | |
<?php the_excerpt(); ?> | |
<?php the_post_thumbnail('medium'); ?> | |
<?php the_time('d.m.Y') ?> | |
<?php the_author(); ?> | |
// bloginfo tags | |
<?php bloginfo('title'); ?> | |
<?php bloginfo('charset'); ?> | |
<?php bloginfo('description'); ?> | |
<?php bloginfo('home').'/' ?> | |
<?php body_class(); ?> | |
<?php language_attributes(); ?> | |
// fileds tags | |
<?php the_field('blog-logo'); ?> | |
<?php the_field('blog-logo', 9); ?> | |
<?php the_field('blog-logo', get_the_ID()); ?> | |
// loops tags | |
<?php while (have_posts()) { the_post(); ?> | |
<?php } ?> | |
<?php | |
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1; | |
$oftenBuy = new WP_Query(array( | |
'numberposts' => 6, | |
'cat' => 15, | |
'orderby' => 'date', | |
'order' => 'ASC', | |
'paged' => $paged | |
)); | |
if ($oftenBuy->have_posts()) { ?> | |
<?php while ($oftenBuy->have_posts()) { $oftenBuy->the_post(); ?> | |
<?php the_field('card-photo_1', get_the_ID()); ?> | |
<?php } ?> | |
<?php } else { ?> | |
<?php echo 'hello'; ?> | |
<?php } wp_reset_postdata(); ?> | |
<?php wp_nav_menu(array( | |
'menu' => 'header_menu', | |
'menu_id' => 'headerNav', | |
'menu_class' => 'nav', | |
'container' => '', | |
)); ?> | |
<?php wp_nav_menu(array( | |
'menu' => 'menu2', | |
'container' => '', | |
'items_wrap' => '%3$s' | |
)); ?> | |
<?php $phone = get_field('blog-phone', 9); ?> | |
<a href="tel:<?php echo str_replace(" ", "", $phoneBot);?>"><?php echo $phone; ?></a> | |
<?php $phones = get_field('blog-phones', 9); | |
if ($phones) { | |
foreach($phones as $phone) { ?> | |
<p><?php echo $phone['field']; ?></p> | |
<? } | |
} | |
?> | |
<?php $categories = get_categories(array( | |
'order' => 'DESC', | |
'child_of' => 0, | |
'hide_empty' => 0, | |
'pad_counts' => 1, | |
'hierarchical' => true, | |
'exclude' => [1, 3] | |
)); | |
if($categories) { | |
foreach($categories as $cat) { | |
if ($cat->parent == 0) { ?> | |
<li> | |
<a href="<?php echo bloginfo('home').'/'.$cat->slug; ?>" class="category"> | |
<span class="category_icon"><img src="<?php the_field('cat_icon', 'category_' . $cat->term_id); ?>?20022017" alt=""></span> | |
<span class="category_name"><?php echo $cat->name; ?></span> | |
<span class="category_posts"><?php echo $cat->count; ?></span> | |
</a> | |
</li> | |
<?php }} | |
} ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment