Exemplo n.º 1
0
    function widget($args, $instance)
    {
        // 输出显示在页面上
        extract($args);
        $id = $instance['id'];
        $before_content = $instance['before_content'];
        $after_content = $instance['after_content'];
        ?>
       
  <?php 
        if (is_category()) {
            ?>
 <?php 
            $cat2 = get_query_var('cat');
            $cat = get_category_root_id($cat2);
            $category = get_category($cat);
            ?>
          <?php 
            if (get_category_children($cat) != "") {
                ?>
      
<div class="widget_left widget_nav_menu">

<div class="widge_hd">
   <span>
  
       <b><?php 
                echo $category->name;
                ?>
</b>
   </span>
  
   </div>

    <ul> <?php 
                if (get_category_children($cat) != "") {
                    wp_list_categories("child_of=" . $cat . "&depth=0&hide_empty=0&title_li=");
                }
                ?>
</ul>
</div>

<?php 
            }
        }
        ?>


 <?php 
        if (is_single()) {
            ?>
 <?php 
            $cat2 = get_query_var('cat');
            $cat = get_category_root_id(the_category_ID(false));
            $category = get_category($cat);
            ?>
          <?php 
            if (get_category_children($cat) != "") {
                ?>
      
<div class="widget_left widget_nav_menu">

<div class="widge_hd">
   <span>
  
       <b><?php 
                echo $category->name;
                ?>
</b><p><?php 
                echo $category->slug;
                ?>
</p>
   </span>
  
   </div>

    <ul> <?php 
                if (get_category_children($cat) != "") {
                    wp_list_categories("child_of=" . $cat . "&depth=0&hide_empty=0&title_li=");
                }
                ?>
</ul>
</div>

<?php 
            }
        }
        ?>
  <?php 
        if (is_page()) {
            ?>
  
    <?php 
            global $wpdb;
            global $post;
            $post_data = get_post($post->ID, ARRAY_A);
            $slug = $post_data['post_name'];
            $name = $slug;
            //page别名
            $parent_id = get_post($post->post_parent, ARRAY_A);
            $parent_slug = $parent_id['post_name'];
            $parent_title = get_the_title($post->post_parent);
            $parent_link = get_page_link($post->post_parent);
            $childrensd = wp_list_pages("title_li=&child_of=" . $post->ID . "&echo=0&depth=1");
            if ($childrensd != "" || $post->post_parent) {
                ?>
       <div class="widget_left widget_nav_menu">

<div class="widge_hd">
 <span>
       <b><?php 
                if ($post->post_parent) {
                    echo $parent_title;
                } else {
                    echo get_the_title();
                }
                ?>
</b><p><?php 
                if ($post->post_parent) {
                    echo $parent_slug;
                } else {
                    echo $slug;
                }
                ?>
</p>
  </span>
   </div>

   
          <?php 
                if ($post->post_parent) {
                    ?>
          <ul class="nav_left">  <?php 
                    $children = wp_list_pages("title_li=&child_of=" . $post->post_parent . "&echo=0&depth=1");
                    if ($children) {
                        echo $children;
                    }
                    ?>
</ul>
        <?php 
                } else {
                    ?>
         <ul class="nav_left"> <?php 
                    $children = wp_list_pages("title_li=&child_of=" . $post->ID . "&echo=0&depth=1");
                    if ($children) {
                        echo $children;
                    }
                    ?>
</ul>
           <?php 
                }
                ?>
 
        
        
</div>
       
        <?php 
            }
        }
    }
Exemplo n.º 2
0
		
		<!--ARTICLE-->
		<div id="article">
			
			<div class="top"><?php 
        //if ( has_post_thumbnail() ) { the_post_thumbnail('medium'); }
        ?>
</div>
			
			<!--ARTICLE TITLE-->
			<div class="title cat-item-<?php 
        the_category_ID();
        ?>
">
				<a href="/?cat=<?php 
        the_category_ID();
        ?>
" class="cat_link"><?php 
        $category = get_the_category();
        echo $category[0]->cat_name;
        ?>
</a>
				<div class="title_content">
					<h4><?php 
        the_title();
        ?>
</h4>
					<div class="author_date">
						<?php 
        if (class_exists('coauthors_plus')) {
            $co_authors = get_coauthors();
Exemplo n.º 3
0
    ?>
                        
<h3> <?php 
    echo $category->name . ' <a>' . $category->slug . ' </a>';
    ?>
</h3>
  
</div>

<?php 
} elseif (is_category()) {
    ?>

<div class="page_top_in">
   <?php 
    $cat = get_category_root_id(the_category_ID(false));
    $cat2 = get_query_var('cat');
    $category2 = get_category($cat2);
    $category = get_category($cat);
    ?>
    
<h3>    <?php 
    if (get_category_children($cat) != "") {
        echo $category->name . ' <a>' . $category->slug . ' </a>';
    } else {
        echo $category2->name . ' <a>' . $category2->slug . ' </a>';
    }
    ?>
 </a></h3>
    
</div>
    function displayHeader($post)
    {
        $html = null;
        if (is_home()) {
            return $html;
        }
        $option = ThemeOption::getPostMeta($post);
        $Validation = new ThemeValidation();
        if (ThemeOption::getGlobalOption($post, 'header_enable')) {
            ThemeHelper::removeUIndex($option, 'header_background_color', 'header_background_image_src', 'header_background_image_position', 'header_background_image_size_1', 'header_background_image_size_2', 'header_text_color', 'header_subheader_text_color', 'header_subheader');
            $subheaderHTML = null;
            $style = array(array(), array(), array());
            if ($Validation->isColor($option['header_background_color'])) {
                $style[0]['background-color'] = ThemeColor::getColor($option['header_background_color']);
            }
            if (!in_array($option['header_background_image_src'], array('-1', 'none'))) {
                if ($Validation->isNotEmpty($option['header_background_image_src'])) {
                    $style[0]['background-image'] = 'url(\'' . $option['header_background_image_src'] . '\')';
                } elseif ($Validation->isNotEmpty(ThemeOption::getGlobalOption(null, 'header_background_image_src'))) {
                    $style[0]['background-image'] = 'url(\'' . ThemeOption::getGlobalOption(null, 'header_background_image_src') . '\')';
                }
            }
            if (array_key_exists('background-image', $style[0])) {
                $style[0]['background-repeat'] = ThemeOption::getGlobalOption($post, 'header_background_image_repeat');
                if ($Validation->isNotEmpty($option['header_background_image_position'])) {
                    $style[0]['background-position'] = $option['header_background_image_position'];
                } elseif ($Validation->isNotEmpty(ThemeOption::getGlobalOption(null, 'header_background_image_position'))) {
                    $style[0]['background-position'] = ThemeOption::getGlobalOption(null, 'header_background_image_position');
                }
                $style[0]['background-size'] = ThemeOption::getGlobalOption($post, 'header_background_image_size_1');
                if (in_array($style[0]['background-size'], array('length', 'percentage'))) {
                    if ($Validation->isNotEmpty($option['header_background_image_size_2'])) {
                        $style[0]['background-size'] = $option['header_background_image_size_2'];
                    } elseif ($Validation->isNotEmpty(ThemeOption::getGlobalOption(null, 'header_background_image_size_2'))) {
                        $style[0]['background-size'] = ThemeOption::getGlobalOption(null, 'header_background_image_size_2');
                    }
                }
            }
            if ($Validation->isColor($option['header_text_color'])) {
                $style[1]['color'] = ThemeColor::getColor($option['header_text_color']);
            }
            if ($Validation->isColor($option['header_subheader_text_color'])) {
                $style[2]['color'] = ThemeColor::getColor($option['header_subheader_text_color']);
            }
            if ($Validation->isNotEmpty($option['header_subheader'])) {
                $subheaderHTML = '<h6' . ThemeHelper::createStyleAttribute($style[2]) . '>' . $option['header_subheader'] . '</h6>';
            } elseif ($post->post_type == 'post') {
                $cat = get_category(the_category_ID(false));
                $cat_name = $cat->cat_name;
                $subheaderHTML = '<h6' . ThemeHelper::createStyleAttribute($style[2]) . '>' . 'Trang chủ / ' . $cat_name . '</h6>';
            }
            $html = '
				<div class="theme-page-header" ' . ThemeHelper::createStyleAttribute($style[0]) . '>
					<div class="theme-main">
						<h1 ' . ThemeHelper::createStyleAttribute($style[1]) . '>' . $post->post_title . '</h1>
						' . $subheaderHTML . '
					</div>
				</div>
			';
        }
        return $html;
    }
function smarty_the_category_ID($params)
{
    $echo = true;
    extract($params);
    return the_category_ID($echo);
}
Exemplo n.º 6
0
function go_post_grabber_shortcode()
{
    echo '';
    $archive_query = new WP_Query('showposts=1000000000');
    while ($archive_query->have_posts()) {
        $archive_query->the_post();
        ?>
		<li>
			<a href="<?php 
        the_permalink();
        ?>
" rel="bookmark" title="Permanent Link to <?php 
        the_title();
        ?>
">
				<?php 
        the_title();
        ?>
			</a> 
				<?php 
        the_time(get_option('date_format'));
        ?>
 
			<a href="/?cat=<?php 
        get_category_link($category_id);
        the_category_ID($echo);
        ?>
">
				<?php 
        $category = get_the_category();
        echo $category[0]->cat_name;
        ?>
			</a>
		</li>
	<?php 
    }
}
Exemplo n.º 7
0
<div class="company_l">
	<h2>服务项目</h2>
    <dl id="leftMenu">
    	<?php 
$post_id = get_the_ID();
$current_cat_id = the_category_ID(false);
$cates = get_category_children(1);
$cates = explode('/', $cates);
$cats = array();
foreach ($cates as $cate) {
    if (!$cate) {
        continue;
    }
    $cat = get_term_by('', $cate, 'category');
    $cats[$cat->description] = $cat;
}
ksort($cats);
foreach ($cats as $cat) {
    $slug = $cat->slug;
    query_posts('cat=' . $cat->term_id . '&orderby=post_date&order=asc&showposts=10');
    $data = array();
    $k = 0;
    $catshow = 0;
    $cathrefflag = 0;
    while (have_posts()) {
        the_post();
        $data[$k]['pid'] = get_the_ID();
        $data[$k]['permalink'] = esc_url(apply_filters('the_permalink', get_permalink()));
        $data[$k]['title'] = the_title('', '', false);
        if (get_post()->post_name == $slug && $cat->name == $data[$k]['title']) {
            $catshow = 1;
Exemplo n.º 8
0
	<!-- single grape end -->

	<!-- the title of wine start -->
	<section class="container">
		<h4><?php 
the_title();
?>
</h4>
	</section>
	<!-- the title of wine end -->

	<!-- wine products start -->
	<section class="container mar">
		<div class="product">
			<?php 
$a = getchild(the_category_ID($echo));
foreach ($a as $v) {
    $v->cat_ID;
}
?>
     		<?php 
$wines = new WP_Query('category__in=' . $v->cat_ID);
if ($wines->have_posts()) {
    while ($wines->have_posts()) {
        $wines->the_post();
        ?>
			<div class="wines clearfix">
				<div class="wines_img">
					<?php 
        the_post_thumbnail('wine-thumbnail');
        ?>
Exemplo n.º 9
0
get_header();
?>

<section class="page"> 

	<div class="container">

			<h1><?php 
single_cat_title('', true);
?>
</h1>

			<ul class="service_catalog">
				<?php 
$catcat = 'cat=' . the_category_ID(false);
query_posts($catcat);
?>
				<?php 
while (have_posts()) {
    the_post();
    ?>
					<li>
						<a href="<?php 
    the_permalink();
    ?>
"><h2 class="title"><?php 
    the_title();
    ?>
</h2></a>