Пример #1
0
function ipin_save_post($post_id, $post)
{
    if ($post->post_type != 'post' || $post->post_status != 'publish') {
        return;
    }
    //Exclude blog category
    $boards = get_the_terms($post_id, 'board');
    if (!$boards && !in_category(ipin_blog_cats(), $post_id)) {
        $board_parent_id = get_user_meta($post->post_author, '_Board Parent ID', true);
        $board_children = get_term_children($board_parent_id, 'board');
        $found = '0';
        $post_category = get_the_category($post_id);
        foreach ($board_children as $board_child) {
            $board_child_term = get_term_by('id', $board_child, 'board');
            if ($board_child_term->name == $post_category[0]->cat_name) {
                $found = '1';
                $found_board_id = $board_child_term->term_id;
                break;
            }
        }
        if ($found == '0') {
            $slug = wp_unique_term_slug($post_category[0]->cat_name . '__ipinboard', 'board');
            //append __ipinboard to solve slug conflict with category and 0 in title
            $new_board_id = wp_insert_term($post_category[0]->cat_name, 'board', array('description' => $post_category[0]->cat_ID, 'parent' => $board_parent_id, 'slug' => $slug));
            $postdata_board = $new_board_id['term_id'];
        } else {
            $postdata_board = $found_board_id;
        }
        //set board
        wp_set_post_terms($post_id, array($postdata_board), 'board');
        //category ID is stored in the board description field
        $category_id = get_term_by('id', $postdata_board, 'board');
        //set category
        wp_set_object_terms($post_id, array(intval($category_id->description)), 'category');
    }
}
Пример #2
0
							<div id="single-pin-above-ad">
								<?php 
        eval('?>' . of_get_option('single_pin_above_ad'));
        ?>
							</div>
							<?php 
    }
    ?>
							
							<div id="post-featured-photo" class="post-featured-photo">
								<div class="post-nav-next"><?php 
    echo previous_post_link('%link', '<i class="fa fa-chevron-right"></i>', false, ipin_blog_cats());
    ?>
</div>
								<div class="post-nav-prev"><?php 
    echo next_post_link('%link', '<i class="fa fa-chevron-left"></i>', false, ipin_blog_cats());
    ?>
</div>
									
								<?php 
    if ($post_video) {
        ?>
									<div class="video-embed-wrapper">
										<?php 
        echo $post_video;
        ?>
									</div>
									<img itemprop="image" class="featured-thumb hide" src="<?php 
        echo $imgsrc[0];
        ?>
" width="<?php 
Пример #3
0
/*
Template Name: _popular
*/
get_header();
?>

<div class="container">
	<div class="row subpage-title">
		<h1><?php 
the_title();
?>
</h1>

		<?php 
$categories = get_categories('exclude=' . implode(',', ipin_blog_cats()) . ', 1');
if ($categories) {
    echo '<div class="text-center">' . __('Category', 'ipin');
    if (!isset($_GET['category'])) {
        $active = ' popular-categories-active';
    }
    echo ' <a class="popular-categories' . $active . '" href="' . get_permalink() . '">' . __('All', 'ipin') . '</a>';
    foreach ($categories as $category) {
        ?>
				<a class="popular-categories<?php 
        if ($_GET['category'] == $category->category_nicename) {
            echo ' popular-categories-active';
        }
        ?>
" href="<?php 
        echo get_permalink();
Пример #4
0
<?php

if (in_category(ipin_blog_cats())) {
    get_template_part('category', 'blog');
} else {
    get_template_part('index');
}