[ajax_load_more post_type="movies" posts_per_page="2"]
<?php wp_head(); ?>
в head и <?php wp_footer(); ?>
перед закрывающим body. <footer id="footer" class="footer text-center text-left-md bgc-light">
<div class="container">
<div class="row">
<div class="col-md-5">
<?php if(($social = get_field('social', 'option'))):?>
<div class="social">
<?php foreach ($social as $item):?>
<a target="_blank" href="<?=$item['link']?>" class="<?=$item['icon']?>"></a>
<?php endforeach;?>
</div>
<?php endif;?>
</div>
<div class="col-md-7 text-right-md">
<div class="copy"><?php the_field('copyright', 'option')?></div>
</div>
</div>
</div>
</footer>
<div class="col-md-12 text-center bgc-light">
<?php the_field('description', 'option')?>
<?php wp_nav_menu( array( 'theme_location' => 'footer', 'menu_class' => 'footer-link' ) ); ?>
</div>
<?php wp_footer(); ?>
</body>
</html>
<?php
add_action('template_ridrect', 'redirect_canonical');
function hasSubdomain() {
$parsed = parse_url($_SERVER['HTTP_HOST']);
$exploded = explode('.', $parsed["host"]);
return (count($exploded) > 2);
}
function twentytwelve_setup() {
// This theme supports a variety of post formats.
add_theme_support( 'post-formats', array( 'aside', 'image', 'link', 'quote', 'status' ) );
add_theme_support( 'post-thumbnails' ); // для всех типов постов
// This theme uses wp_nav_menu() in one location.
register_nav_menu( 'primary', __( 'Primary Menu', 'twentytwelve' ) );
// This theme uses wp_nav_menu() in one location.
register_nav_menu( 'footer', "Подвал" );
register_nav_menu( 'header_test', "Test modal signup" );
// This theme uses a custom image size for featured images, displayed on "standard" posts.
//add_theme_support( 'post-thumbnails' );
//set_post_thumbnail_size( 624, 9999 ); // Unlimited height, soft crop
// Indicate widget sidebars can use selective refresh in the Customizer.
//add_theme_support( 'customize-selective-refresh-widgets' );
}
add_action( 'after_setup_theme', 'twentytwelve_setup' );
function scripts_styles() {
wp_enqueue_script("theme-jquery", get_template_directory_uri(). '/js/jquery.js', [], false, true);
wp_enqueue_script("theme-bs", get_template_directory_uri(). '/js/bootstrap.min.js', [], false, true);
wp_enqueue_script("theme-wow", get_template_directory_uri(). '/js/wow.min.js', [], false, true);
wp_enqueue_script("theme-popup", get_template_directory_uri(). '/js/jquery.magnific-popup.min.js', [], false, true);
wp_enqueue_script("theme-owl", get_template_directory_uri(). '/js/owl.carousel.min.js', [], false, true);
wp_enqueue_script("theme-stellar", get_template_directory_uri(). '/js/jquery.stellar.min.js', [], false, true);
wp_enqueue_script("theme-interface", get_template_directory_uri(). '/js/interface.js', [], false, true);
wp_enqueue_script("theme-cpapi", get_template_directory_uri(). '/js/interface-ci.js', [], false, true);
}
add_action( 'wp_enqueue_scripts', 'scripts_styles' );
function my_deregister_scripts(){
wp_deregister_script( 'wp-embed' );
}
add_action( 'wp_footer', 'my_deregister_scripts' );
function cc_mime_types($mimes) {
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter('upload_mimes', 'cc_mime_types');
if( function_exists('acf_add_options_page') ) {
acf_add_options_page();
acf_set_options_page_title('Опции');
}
function social_shortcode(){
$social = get_field('social');
$html = "";
if($social) {
$html .= '<div class="f-social">';
foreach($social as $item) {
$html.=" <a href=\"{$item['link']}\" target='_blank'><i class=\"{$item['css']}\"></i></a>";
}
$html .= "</div>";
}
return $html;
}
add_shortcode( 'social', 'social_shortcode' );
function footer_enqueue_scripts(){
remove_action('wp_head','wp_print_scripts');
remove_action('wp_head','wp_print_head_scripts',9);
remove_action('wp_head','wp_enqueue_scripts',1);
add_action('wp_footer','wp_print_scripts',5);
add_action('wp_footer','wp_enqueue_scripts',5);
add_action('wp_footer','wp_print_head_scripts',5);
}
add_action('after_setup_theme','footer_enqueue_scripts');
function register_my_widgets(){
register_sidebar( array(
'name' => "menus",
'id' => "sidebar_menu",
'description' => 'описание',
'class' => '',
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => "</li>\n",
'before_title' => '<h2 class="widgettitle">',
'after_title' => "</h2>\n",
) );
}
add_action( 'widgets_init', 'register_my_widgets' );
function reading_time() {
$content = get_post_field( 'post_content', $post->ID );
$word_count = str_word_count( strip_tags( $content ) );
$readingtime = ceil($word_count / 200);
if ($readingtime == 1) {
$timer = " min read";
} elseif ($readingtime == 2 || $readingtime == 3 || $readingtime == 4) {
$timer = " min read";
} else {
$timer = " min read";
}
$totalreadingtime = '' . $readingtime . $timer;
return $totalreadingtime;
}
function setPostViews($postID) {
$count_key = 'post_views_count';
$count = get_post_meta($postID, $count_key, true);
if($count==''){
$count = 0;
delete_post_meta($postID, $count_key);
add_post_meta($postID, $count_key, '0');
}else{
$count++;
update_post_meta($postID, $count_key, $count);
}
}
function getPostViews($postID){
$count_key = 'post_views_count';
$count = get_post_meta($postID, $count_key, true);
if($count==''){
delete_post_meta($postID, $count_key);
add_post_meta($postID, $count_key, '0');
return "0";
}
return $count;
}
function trim_title_chars($count, $after) {
$title = get_the_title();
if (mb_strlen($title) > $count) $title = mb_substr($title,0,$count);
else $after = '';
echo $title . $after;
}
function tutsplus_related_posts() {
$post_id = get_the_ID();
$cat_ids = array();
$categories = get_the_category( $post_id );
if ( $categories && !is_wp_error( $categories ) ) {
foreach ( $categories as $category ) {
array_push( $cat_ids, $category->term_id );
}
}
$current_post_type = get_post_type( $post_id );
$args = array(
'category__in' => $cat_ids,
'post_type' => $current_post_type,
'orderby' => 'title menu_order',
'posts_per_page' => '2',
'post__not_in' => array( $post_id )
);
$query = new WP_Query( $args );
if ( $query->have_posts() ) {
?>
<?php
while ( $query->have_posts() ) {
$query->the_post();
?>
<div class="col-md-4 col-sm-6" id="<?php the_ID(); ?>">
<div class="wrap_post_last" style="background-color: #f4f3f3; height: 454PX;background-size: cover;border-radius: 13px !important;margin-bottom: 30px;">
<div class="img_pos smalls " style="background:url(<?php $thumb_id = get_post_thumbnail_id();$thumb_url = wp_get_attachment_image_src($thumb_id,'thumbnail-size', true);echo $thumb_url[0];?>);height: 250px;background-position: 50%;border-top-left-radius: 13px;border-top-right-radius: 13px; background-repeat: no-repeat;"></div>
<div class="gradient">
<a href="<?php the_permalink( $post ); ?>" class="post_link"><?php trim_title_chars(30, '...'); ?></a>
<div class="meta_slider_post">
<span><?php $cat = get_the_category(); echo $cat[0]->cat_name; ?></span> | <span><?php echo reading_time(); ?></span>
</div>
</div>
</div>
</div>
<?php
}
?>
<?php
}
wp_reset_postdata();
}
add_action('after_setup_theme','footer_enqueue_scripts');