function ft_exclude_category_from_home($query)
{
    $featured = get_cat_id('featured');
    if ($query->is_main_query() && $query->is_home()) {
        $query->set('cat', '-' . $featured);
    }
}
Пример #2
0
    /** @see WP_Widget::widget */
    function widget($args, $instance)
    {
        extract($args);
        $title = $instance['title'];
        $title = apply_filters('widget_title', empty($instance['title']) ? __('Latest tweets', 'framework') : $instance['title'], $instance, $this->id_base);
        $categ_parent = $instance['parent_category'];
        $categ_parent_id = get_cat_id(htmlentities($categ_parent));
        echo $before_widget;
        ?>

	    <?php 
        echo $before_title . $title . $after_title;
        ?>

		<?php 
        $categ_args = array('child_of' => $categ_parent_id, 'title_li' => '', 'show_option_none' => __('<p class="textwidget">No child categories that belong to the parent category you\'ve selected were found.</p>', 'framework'));
        ?>
    
    
		<ul>
			<?php 
        wp_list_categories($categ_args);
        ?>
        </ul>
    
            <?php 
        echo $after_widget;
        ?>
            
        <?php 
    }
Пример #3
0
function myTemplateSelect()
{
    if (is_category() && !is_feed()) {
        if (is_category(get_cat_id('projekt')) || cat_is_ancestor_of(get_cat_id('projekt'), get_query_var('cat'))) {
            load_template(STYLESHEETPATH . '/category-projekt.php');
            exit;
        }
    }
}
 protected function constantTest()
 {
     $post_id_1 = 0;
     $time = microtime(true);
     for ($i = 0; $i < $this->runNumber; $i++) {
         get_cat_id("Uncategorized");
     }
     $time = microtime(true) - $time;
     $this->enterResult($time);
 }
Пример #5
0
 function start_el(&$output, $item, $depth, $args)
 {
     $cur_cat_id = get_cat_id(single_cat_title("", false));
     $url = '#' !== $item->url ? $item->url : '';
     if (get_category_link($cur_cat_id) == $url) {
         $output .= '<option class="active" selected="selected" value="' . $url . '">' . $item->title;
     } else {
         $output .= '<option value="' . $url . '">' . $item->title;
     }
 }
 public function render()
 {
     /* @var $post \WP_Post */
     global $post;
     $this->entries = array();
     $this->addHomePage();
     if (!is_front_page() && is_home()) {
         $show_on_front = get_option('show_on_front');
         if ($show_on_front == 'page') {
             $this->addBlogPage();
         }
     } elseif (is_tag()) {
         $this->addBlogPage();
         $tag_id = get_query_var('tag_id');
         $this->addTag($tag_id);
     } elseif (is_category()) {
         $this->addBlogPage();
         $cat_id = get_cat_id(single_cat_title('', false));
         $this->addCategory($cat_id);
     } elseif (is_author()) {
         $this->addAuthor(get_the_author_meta('ID'));
     } elseif (is_search()) {
         $this->addSearch(get_search_query());
     } elseif (is_page()) {
         $this->addPage($post->ID);
     } elseif (is_single()) {
         $this->addBlogPage();
         $categories = get_the_category();
         if (isset($categories[0])) {
             $this->addCategory($categories[0]->cat_ID);
         }
         $this->addPost($post->ID);
     } elseif (is_401()) {
         $this->addErrorPage(401);
     } elseif (is_403()) {
         $this->addErrorPage(403);
     } elseif (is_404()) {
         $this->addErrorPage();
     } elseif (is_tax()) {
         $this->addBlogPage();
         $term = get_query_var('term');
         $tax = get_query_var('taxonomy');
         if ($tax == 'post_format') {
             $this->addPostFormat($term);
         }
     } elseif (is_archive()) {
         $this->addBlogPage();
         $this->addDate(is_year() || is_month() || is_day() ? get_the_time('Y') : false, is_year() || is_month() ? get_the_time('m') : false, is_day() ? get_the_time('d') : false);
     }
     return $this->entries;
 }
Пример #7
0
function create_story($param)
{
    //the new post object
    $post = array('post_status' => 'draft', 'post_author' => $param['author'], 'post_category' => array((int) get_cat_id('histoire')));
    if ($param['content']) {
        $post['post_content'] = $param['content'];
    }
    if ($param['title']) {
        $post['post_title'] = wp_strip_all_tags($param['title']);
    }
    //insert the post in db
    $post_id = wp_insert_post($post, true);
    //updates localisation custom field
    if ($param['localisation']) {
        update_field("field_5654eb30ea15e", $param['localisation'], $post_id);
    }
    if ($param['tags']) {
        wp_set_post_tags($post_id, $param['tags']);
    }
    return formatted_post(get_post($post_id));
}
Пример #8
0
}
?>
          </div>
          <a href="<?php 
echo esc_url(home_url('/'));
?>
wp-admin" class="btn-large waves-effect waves-light  blue darken-4">Login to the Wordpress Dashboard</a>
        </div>



        <div class="col m12 l4">
          <div class="icon-block">
            <h5 class="center">Learning Calendar and Staff Events</h5>
            <!--<?php 
$category_id = get_cat_id('Staff Events');
echo $category_id;
?>
-->
            <ul class="collection">
              <?php 
query_posts('cat=140,141&showposts=5');
?>
              <?php 
if (have_posts()) {
    while (have_posts()) {
        the_post();
        ?>
              <li><a href="<?php 
        the_permalink();
        ?>
Пример #9
0
 $goods_id = intval(pq('input[name="id"]')->attr('value'));
 // 说明源id大于47900是无水印的 http://www.tomdurrie.com/search.php?page=380 前判读吧..
 // 63767 后面开始进行第二次采集
 if ($goods_id > 63767) {
     // 删除旧产品数据和相册数据
     delete('ecs_goods', array('goods_id' => $goods_id));
     delete('ecs_goods_gallery', array('goods_id' => $goods_id));
     $cat_name = trim(pq('#ur_here>.f_l>a:eq(1)')->html());
     $brand_name = trim(pq('.props>dl:eq(1)>dd')->html());
     $price_tmp = trim(pq('#ECS_SHOPPRICE')->html());
     if (preg_match('(\\d+)', $price_tmp, $match)) {
         $price = $match[0];
     } else {
         $price = 0;
     }
     $goods_info = array('goods_id' => $goods_id, 'cat_id' => get_cat_id($cat_name), 'goods_sn' => trim(pq('.props>dl:eq(0)>dd')->html()), 'goods_name' => trim(pq('h1')->html()), 'goods_desc' => '<table>' . pq('div>table')->html() . '</table>', 'brand_id' => get_brand_id($brand_name), 'goods_number' => 9999, 'market_price' => (int) floor($price / 0.57), 'shop_price' => $price, 'goods_thumb' => 'http://baobaopic.qiniudn.com/' . $v['thumb_img_org']);
     $result = insert('ecs_goods', $goods_info);
     /**
      * 获取相册
      * 
      */
     $gallerys_tmp = pq('.gallery>#demo>#demo1>ul>li');
     $goods_gallerys = array();
     foreach ($gallerys_tmp as $li) {
         $img_url = trim(pq($li)->find('a')->attr('rev'));
         $thumb_url = trim(pq($li)->find('img')->attr('src'));
         $goods_gallerys[] = array('goods_id' => $goods_id, 'img_url' => !empty($img_url) ? 'http://baobaopic.qiniudn.com/' . $img_url : '', 'thumb_url' => !empty($thumb_url) ? 'http://baobaopic.qiniudn.com/' . $thumb_url : '');
     }
     if (isset($goods_gallerys[0]['img_url']) && !empty($goods_gallerys[0]['img_url'])) {
         $gallery_result = insert_batch('ecs_goods_gallery', $goods_gallerys);
     }
Пример #10
0
			</div> 
                
             <!--  <div class="new_add_archives_and_categories">
				<div class="ForumBox SelectBox">
                	<h2>Archives</h2>
                    <?php 
// wp_get_archives('type=monthly');
?>
		
		<select name=\"archive-dropdown\" onChange='document.location.href=this.options[this.selectedIndex].value;'> 
		<option value=\"\"><?php 
echo attribute_escape(__('Select Month'));
?>
</option> 
		<?php 
wp_get_archives('type=monthly&format=option&cat=' . get_cat_id('Events'));
?>
 </select><br/><br/><br/>
                    
                    <h2>Categories</h2>
                    <select>
                    	<option>Select Categories</option>
                    </select>
                </div>
				</div> -->
            
            </div>
            <!-- END OF RIGHTCOL -->
            
            <div class="clear"><!-- DON'T DELETE --></div>  
            
Пример #11
0
            $tags = get_the_tags($post->ID);
            foreach ($tags as $tag) {
                $key .= $tag->name . ', ';
            }
            if ($key != "") {
                $keywords = $key;
            }
        }
    } else {
        if (is_archive()) {
            if (is_tag()) {
                $meta_title = $title = 'Tags' . ' | ' . $meta_title;
                $description_content = preg_replace("/&#?[a-z0-9]+;/i", "", tag_description($tag->term_id));
            } else {
                $meta_title = $title = preg_replace("/&#?[a-z0-9]+;/i", "", $meta_title);
                $cat_id = get_cat_id(single_cat_title('', false));
                $description_content = preg_replace("/&#?[a-z0-9]+;/i", "", category_description($cat_id));
            }
        }
    }
}
?>
<title><?php 
echo esc_html($meta_title);
?>
</title>
<meta name="description" content="<?php 
echo esc_attr(trim(strip_tags($description_content)));
?>
">
<meta name="keywords" content="<?php 
Пример #12
0
            } elseif (in_category(144)) {
                echo 'rocio';
            }
            if (in_category($espera)) {
                echo ' espera';
            }
            ?>
" id="post-<?php 
            the_ID();
            ?>
">
				<?php 
            // Show the new category images
            foreach (get_the_category() as $category) {
                $proyectos = get_option('bach_projects');
                $proyecto = get_cat_id($proyectos);
                if (get_root_category($category) == $proyecto) {
                    echo '<a href="' . get_bloginfo('url') . '/category/' . $category->slug . '"><img src="' . trim(ereg_replace("</p>", "", category_description($category->cat_ID)), "<p>") . '" alt="' . $category->cat_name . '" class="logo" height="48px" width="48px" style="float:right;" /><a>';
                }
            }
            ?>
				
				<h3 class="titulillo"><a href="<?php 
            the_permalink();
            ?>
"><?php 
            the_title();
            ?>
</a></h3>
						<div align="center"><?php 
            include TEMPLATEPATH . '/clases.php';
Пример #13
0
function myprefix_query_offset(&$query)
{
    /* don't show in focus posts on homepage */
    if ($query->is_home()) {
        $trending_cat_id = get_cat_id('Compass');
        $guidebook_cat_id = get_cat_id('Guidebook');
        $tax_query = array(array('taxonomy' => 'category', 'field' => 'term_id', 'terms' => [$trending_cat_id, $guidebook_cat_id], 'operator' => 'NOT IN'));
        $query->set('tax_query', $tax_query);
    }
    if (!($query->is_home() && $query->is_main_query())) {
        return;
    }
    $ppp = get_option('posts_per_page');
    if (is_paged()) {
        $offset = -1 * ($ppp - get_option('homepage_post_count'));
        $sticky_posts = get_option('sticky_posts');
        $numStickies = 0;
        if (is_array($sticky_posts)) {
            $numStickies = sizeof($sticky_posts);
            $offset = $offset - $numStickies;
        }
        //note ... if we make more posts sticky than can take up a whole page, we'd have an issue.
        //not worrying about that edge case as it's not feasible.
        $page_offset = $offset + (get_query_var('paged') - 1) * $ppp;
        $query->set('offset', $page_offset);
    } else {
        //we handle the custom logic for the first page in index.php - so nothing to do in this clause
    }
}
Пример #14
0
<?php
			$prioridades = get_option('bach_priorities'); 
			$priorities = get_cat_id($prioridades);
			$proyectos = get_option('bach_projects'); 
			$projects = get_cat_id($proyectos);
			$usuarios = get_option('bach_users'); 
			$users = get_cat_id($usuarios);
			$abierto = get_option('bach_open'); 
			$open = get_cat_id($abierto);
			$padre = $wpdb->get_var("SELECT parent from $wpdb->term_taxonomy WHERE term_id = '$open'");
?>

<div id="sidebar">
	<div style="float:left;"><?php include (TEMPLATEPATH . '/searchform.php'); ?></div>

<ul>
<?php 
if( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) { 
	$before = "<li><h2>Proyectos recientes</h2>\n";
	$after = "</li>\n";

	$num_to_show = 35;

	echo prologue_recent_projects( $num_to_show, $before, $after );
} // if dynamic_sidebar
?>
</ul>


<?
Пример #15
0
<?php get_header();?>

<?php $catid = get_cat_id( single_cat_title("",false) );?>

<head><title>Search result for <?php   echo '"' . $_GET['s'] . '"' . ' - '; bloginfo('name'); ?></title></head>
<div class="container contain-content">

	<?php get_search_form();?>

	<div class="shadow-box shadow-box-colour"><h6>Search Result for : <?php echo $_GET['s'];?></h6></div>

	<?php if (have_posts()) : while(have_posts()) : the_post();?>
		<div class="shadow-box-page shadow-box-colour">
			<a class = 'header-link' href="<?php the_permalink();?>" title = "<?php the_title();?>"><h3 class = "header-text text-center"><?php the_title();?></h3></a>
			<center><?php if (has_post_thumbnail()) {the_post_thumbnail('large',array('class' => 'img-responsive img-thumb'));} ?></center>
			<p class = "content"><?php the_excerpt(); ?></p>
		</div>
		<?php endwhile; else : ?>
			<div class="shadow-box-page shadow-box-colour block-center">
				<center>
					<h4 style = "margin-top:5px;">We can't found what you are looking for.</h4>
					<p class=  "text-muted">Try other keyword or <a href="<?php echo get_option('home');?>">Go Home?</a></p>
				</center>
	</div>		<?php endif; ?>
</div>
<script async src = "<?php echo get_template_directory_uri(); ?>/js/all.min.js"></script>
Пример #16
0
					<a href="<?php 
    echo $categoryLink;
    ?>
" style="display: block; clear: left;">Read more <?php 
    echo $teamCategory->name;
    ?>
 posts »</a>
					<?php 
}
?>
					
				</section>


				<?php 
$qParams = array('post_type' => array('post'), 'posts_per_page' => $numPortfolioPostsToShow, 'category__and' => [$teamCategoryID, get_cat_id('Project')]);
query_posts($qParams);
$numProjectsAvailable = $wp_query->found_posts;
if (have_posts()) {
    ?>


						<section class="usa-section usa-grid">
							<h6 class="bbg-label small"><a href="<?php 
    echo $teamPortfolioLink;
    ?>
"><?php 
    echo $teamCategory->name;
    ?>
 projects</a></h6>
							<div class="bbg-grid__container">
Пример #17
0
<?php

get_header();
$cur_cat_id = get_cat_id(single_cat_title("", false));
?>
<main class="clear-head white container">

<section class="page-title clear-head">
        <h1><?php 
single_cat_title('', true);
?>
</h1>
</section>

<div class="range-item-container">
    <?php 
query_posts(array('post_type' => array('materials', '3d-printers'), 'cat' => $cur_cat_id));
?>
    <?php 
if (have_posts()) {
    while (have_posts()) {
        the_post();
        ?>
        <div class="range-item">
            <a href="<?php 
        the_permalink();
        ?>
">
                <div>
                    <?php 
        $url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'medium');
 /**
  * Imports options and fields from the XML file given.
  * @param $xmlFilename	the file to import from.
  * @return boolean	true on success, false on failure
  */
 function importFromXML($xmlFilename)
 {
     //parse the xml file
     $xmlParser = new PhotoQXMLParser($xmlFilename);
     $xmlParser->parse();
     //store the parsed options if they validate
     if ($xmlParser->validate()) {
         $optionArray = $xmlParser->getParsedOptions();
         $fieldArray = $xmlParser->getParsedFields();
         $catsArray = $xmlParser->getParsedCats();
         //right now we only support one default category
         $defaultCat = null;
         if (!empty($catsArray)) {
             $defaultCat = $catsArray[0];
         }
         //delete views that are no longer used in the new settings
         $this->_deleteObsoleteViews($this->getViewNames(), $xmlParser->getViewNames());
         //delete image sizes that are no longer used in the new settings
         $this->_deleteObsoleteImageSizes($this->getImageSizeNames(), $xmlParser->getImageSizeNames());
         //add custom fields required by views setting of xml file,
         //conflicts with fields will not happen as this is already tested in validation.
         foreach ($xmlParser->getViewNames(true) as $view) {
             $this->addViewCallback($view, true);
         }
         //it may happen that some fields are already there. Do not show an error in this case
         $this->_errStack->pushCallback(array('PhotoQErrorHandler', 'mutePHOTOQ_FIELD_EXISTS'));
         //create fields required by the xml file
         foreach ($fieldArray as $fieldname) {
             $this->_db->insertField($fieldname, true);
         }
         //add default tags to all photoq posts
         if (isset($optionArray['qPostDefaultTags']['qPostDefaultTags']) && !empty($optionArray['qPostDefaultTags']['qPostDefaultTags'])) {
             $newTags = preg_split("/[\\s]*,[\\s]*/", $optionArray['qPostDefaultTags']['qPostDefaultTags']);
             $postIDs = $this->_db->getAllPublishedPhotoIDs();
             foreach ($postIDs as $id) {
                 //update the tags in the database
                 wp_set_post_tags($id, add_magic_quotes($newTags), true);
             }
             //update all posts in the queue
             $qEntries = $this->_db->getQueueIDTagPairs();
             foreach ($qEntries as $entry) {
                 $oldTags = preg_split("/[\\s]*,[\\s]*/", $entry->q_tags);
                 $tagString = implode(',', array_unique(array_merge($newTags, $oldTags)));
                 $this->_db->updateTags($entry->q_img_id, $tagString);
             }
         }
         //same for default category
         if ($defaultCat) {
             //create it if it does not exist
             if (!category_exists($defaultCat)) {
                 $catID = wp_insert_category(array('cat_name' => $defaultCat));
                 if (is_wp_error($catID)) {
                     $defaultCat = NULL;
                 }
             } else {
                 $catID = get_cat_id($defaultCat);
             }
             //get all posts and add default category to list of cats
             $postIDs = $this->_db->getAllPublishedPhotoIDs();
             foreach ($postIDs as $id) {
                 //update the tags in the database
                 wp_set_object_terms($id, $defaultCat, 'category', true);
             }
             //update all posts in the queue
             if (!is_wp_error($catID)) {
                 $qIds = $this->_db->getAllQueuedPhotoIDs();
                 foreach ($qIds as $id) {
                     if (!in_array($catID, $this->_db->getCategoriesByImgId($id))) {
                         $this->_db->insertCategory($id, $catID);
                     }
                 }
             }
         }
         //store the imported options to the database
         $storedOptions = get_option($this->_optionsDBName);
         foreach ($optionArray as $key => $val) {
             if (array_key_exists($key, $storedOptions)) {
                 $storedOptions[$key] = PhotoQHelper::arrayHtmlEntities($val);
             }
         }
         update_option($this->_optionsDBName, $storedOptions);
         //reload to make the changes active
         $this->load();
         return true;
     }
     return false;
 }
Пример #19
0
</label><br class="clear" />
                      <input type="text" name="url" id="url" value="<?php 
            echo $comment_author_url;
            ?>
" />
                      </div>
                      
                      <?php 
        }
        ?>
                      
                      <div class="Smallbox">
                      <textarea name="comment" id="comment" cols="100%"></textarea>
                      </div>
                      <?php 
        if (in_category(get_cat_id('Companies')) || $in_subcategory_companies) {
            ?>
                      <input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" />
                      <?php 
        } else {
            ?>
					  <input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" />
				      <?php 
        }
        ?>
                      <input type="hidden" name="comment_post_ID" value="<?php 
        echo $id;
        ?>
" />
                      
                      <?php 
Пример #20
0
function fly_excerptlist_func($atts)
{
    extract(shortcode_atts(array('titleonly' => 'n', 'cat' => '', 'num' => 5), $atts));
    $args = array('posts_per_page' => $num);
    $id = get_cat_id($cat);
    $args['cat'] = $id;
    $loop = new WP_Query($args);
    $posts = array();
    foreach ($loop->posts as $p) {
        $posts[] = $p;
    }
    global $post;
    $opost = $post;
    ob_start();
    ob_start();
    $ret = apply_filters('excerptlist', $posts);
    if (is_array($ret) || $ret == "" || $ret == " ") {
        $ret = ob_get_contents();
    }
    ob_end_clean();
    if (!is_array($ret) && $ret != "") {
    } else {
        if (strtolower($titleonly) != "y") {
            $ret = '
   <div class="excerptlist"> ';
            foreach ($posts as $post) {
                setup_postdata($post);
                $ret .= ' <div class="articleexcerpt"> 


       <div class="thumb">';
                if (has_post_thumbnail()) {
                    $ret .= ' <a href="' . get_permalink($post->ID) . '">' . get_the_post_thumbnail($post->ID, array(125, 125), array('class' => 'articleimg')) . '</a>';
                } else {
                    if (get_theme_option('art-thumb')) {
                        $ret .= '<a href="' . get_permalink($post->ID) . '"><img class="articleimg" src="' . get_theme_option('art-thumb') . '" alt="' . get_the_title($post->ID) . '" width="125" height="125" /></a>';
                    }
                }
                $ret .= '</div>
		<h3 class="title"><a href="' . get_permalink($post->ID) . '" rel="bookmark">' . get_the_title($post->ID) . '</a></h3>';
                if (!get_theme_option('bylines-hide-all')) {
                    $ret .= ' <div class="bylines"> 

               ' . (!get_theme_option("bylines-hide-date") ? get_the_time('F j, Y') : "") . ' 
               ' . (!get_theme_option("bylines-hide-author") ? "by" : "") . ' 
               ' . (!get_theme_option("bylines-hide-author") ? "<a href=\"" . get_author_posts_url(get_the_author_meta('ID')) . "\">" . get_the_modified_author() . " </a>" : "") . ' 

 ' . (!get_theme_option("bylines-hide-category") ? "posted in " : "") . ' 
            ' . (!get_theme_option("bylines-hide-category") ? get_the_category_list(', ', '', $post->ID) : "") . '

' . (!get_theme_option("bylines-hide-comment") ? '&bull; <a href="' . get_permalink($post->ID) . '#comments">  ' . get_comments_number() . ' comments </a>' : "") . '
 
			
		</div>';
                }
                $ret .= '  <p>' . get_the_excerpt() . '</p>

		

            </div><!-- End of articleexcerpt  --> ';
            }
            $post = $opost;
            $ret .= '</div><!-- End of excerptlist  --> ';
        } else {
            $ret = '<ul> ';
            foreach ($posts as $post) {
                setup_postdata($post);
                $ret .= '<li class="exelist"><a href="' . get_permalink($post->ID) . '" rel="bookmark">' . get_the_title($post->ID) . '</a></li>';
            }
            $post = $opost;
            $ret .= '</ul>';
        }
    }
    return $ret;
}
Пример #21
0
<?php
		// Get ID's
	
		$user			= get_userdata( $current_user->ID );
		$first_name		= attribute_escape( $user->first_name );

			$prioridades = get_option('bach_priorities'); 
			$priorities = get_cat_id($prioridades);
			$proyectos = get_option('bach_projects'); 
			$projects = get_cat_id($proyectos);
			$usuarios = get_option('bach_users'); 
			$users = get_cat_id($usuarios);



?>
<div align="center">
<div id="postbox">
	<form id="new_post" name="new_post" method="post" action="<?php bloginfo( 'url' ); ?>/#actual-day">

		<input type="hidden" name="action" value="post" />
		<?php wp_nonce_field( 'new-post' ); ?>

		<?php echo prologue_get_avatar( $user->ID, $user->user_email, 48 ); ?>

            <input type="text" name="postTitle" id="postTitle" tabindex="1" size="60" />
<br />
		<textarea name="posttext" id="posttext" rows="3" cols="60" tabindex="2" ></textarea>

	<script>
           jQuery(document).ready(function() {
Пример #22
0
 function jr_get_current_url($url = '')
 {
     if (is_front_page() || is_search() || is_front_page()) {
         return trailingslashit(get_bloginfo('wpurl'));
     } elseif (is_category()) {
         return trailingslashit(get_category_link(get_cat_id(single_cat_title("", false))));
     } elseif (is_tax()) {
         $job_cat = get_query_var('job_cat');
         $job_type = get_query_var('job_type');
         if (isset($job_cat) && $job_cat) {
             $slug = $job_cat;
             return trailingslashit(get_term_link($slug, 'job_cat'));
         } elseif (isset($job_type) && $job_type) {
             $slug = $job_type;
             return trailingslashit(get_term_link($job_type, 'job_type'));
         }
     }
     return trailingslashit($url);
 }
Пример #23
0
function colormag_colored_category_title($title)
{
    $color_value = colormag_category_color(get_cat_id($title));
    $color_border_value = colormag_category_color(get_cat_id($title));
    if (!empty($color_value)) {
        return '<h3 class="page-title" style="border-bottom-color: ' . $color_border_value . '">' . '<span style="background-color: ' . $color_value . '">' . $title . '</span></h3>';
    } else {
        return '<h3 class="page-title"><span>' . $title . '</span></h3>';
    }
}
Пример #24
0
<?php

get_header();
?>
    <section id="content" class="row">
                <div class="col-md-8 left-column">
                    <h2 class="archive_page_name">
                    </h2>
                    <div class="tab-content">
                        <?php 
if (is_category()) {
    global $wpdb;
    global $post;
    $categoy_id = get_cat_id(single_cat_title("", false));
    $numpost = 10;
    $curentpost = 0;
    $args = array('cat' => $categoy_id, 'posts_per_page' => $numpost, 'offset' => $curentpost);
    $the_query = new WP_Query($args);
    if ($the_query->have_posts()) {
        while ($the_query->have_posts()) {
            $the_query->the_post();
            setup_postdata($post);
            $html .= get_template_part('content', 'short');
        }
        wp_reset_postdata();
    } else {
        ?>
                            <p> <?php 
        echo _e('Not have post in category');
        ?>
</p>
Пример #25
0
function colormag_colored_category_title($title)
{
    //生成子分类成导航
    $obj_id = get_queried_object_id();
    $cate = get_category($obj_id);
    if ($cate->parent > 0) {
        $sub_cate_id = $cate->parent;
    } else {
        $sub_cate_id = $obj_id;
    }
    $sub_cate = get_categories(array('child_of' => $sub_cate_id));
    if ($sub_cate) {
        foreach ($sub_cate as $cate) {
            $sub_title .= '<span style="padding-left:10px;background:#FFF"><a href="' . get_category_link($cate->cat_ID) . '">' . $cate->cat_name . '</a></span>';
        }
    } else {
        $sub_title = '';
    }
    //echo $sub_title;
    $color_value = colormag_category_color(get_cat_id($title));
    $color_border_value = colormag_category_color(get_cat_id($title));
    if (!empty($color_value)) {
        return '<h1 class="page-title" style="border-bottom-color: ' . $color_border_value . '">' . '<span style="background-color: ' . $color_value . '">' . $title . '</span>' . $sub_title . '</h1>';
    } else {
        return '<h1 class="page-title"><span>' . $title . '</span>' . $sub_title . '</h1>';
    }
}
Пример #26
0
 function sidebar_eventos2()
 {
     $cat_id = get_cat_id("Próximos");
     $arr_prensa = array('posts_per_page' => '3', 'showposts' => '3', 'post_type' => 'post', 'order' => 'DESC', 'category__and' => array($cat_id), 'orderby' => 'DATE');
     $wp_query_prensa = new WP_Query($arr_prensa);
     if ($wp_query_prensa->have_posts()) {
         while ($wp_query_prensa->have_posts()) {
             $wp_query_prensa->the_post();
             if (has_post_thumbnail()) {
                 $imagen_id = get_post_thumbnail_id();
                 $img = wp_get_attachment_image_src($imagen_id, 'eventos_sidebar2');
             }
             $title = get_the_title();
             $link = get_permalink();
             echo '<article class="plg-prox-event-int bg-gris">
                 <img src="' . $img[0] . '" class="img-responsive" />
                 <time>
                     <span class="dia">21</span>/
                     <span class="mes">05</span>/
                     <span class="ano">2014</span>
                 </time>
                 <h4>' . $title . '</h4>
             </article>';
         }
     }
 }
<?php

/**
template name: Deprecated - Trending old style
* The template for displaying our "in focus" view.
* In this version we just show the most recent 'in focus' post
* @package Independent Publisher
* @since   Independent Publisher 1.0
*/
$pageBodyID = "trending";
$trendingCatID = get_cat_id('Trending');
/**** GET A SPECIAL PERMALINK FOR THE TWITTER AND FB SHARE BUTTONS *****/
$qParams = array('post_type' => array('post'), 'posts_per_page' => 1, 'orderby' => 'post_date', 'order' => 'desc', 'cat' => $trendingCatID);
//echo "catid " . $cat_id . "<BR>";
query_posts($qParams);
if (have_posts()) {
    while (have_posts()) {
        the_post();
        $trendingPostPermalink = post_permalink(get_the_id());
        $ogUrl = $trendingPostPermalink;
    }
}
rewind_posts();
/***** DONE GETTING SPECIAL PERMALINK ******/
get_header();
?>
 
	<!-- temporary fix -->
	<div id="logoOnPostPages">
		<a class="site-logo" href="https://africa.rizing.org/" title="Africa Rizing" rel="home">
			<img class="no-grav" src="https://africa.rizing.org/wp-content/uploads/2015/10/cropped-Rize-socialprofiles_500.png" height="501" width="501" alt="Africa Rizing">
Пример #28
0
    <div class="container">
  		
     <div class="cont_lft fltlft">
     	<div class="cont_panel fltlft">
        	<?php 
dynamic_sidebar('Main Sidebar');
?>
<!--  join  -->
        </div> <!--  cont_panel  -->
   	  <div class="new_panel fltrht">
		<?php 
wp_reset_query();
?>
				<?php 
$cat2 = "News";
$cat2_id = get_cat_id($cat2);
$qry = query_posts("category_name='News'&showposts=3");
?>
				<?php 
$temp3 = get_post_custom_values("News_images", 48);
?>
         <h1><?php 
echo $cat2;
?>
</h1>
			<?php 
if (have_posts()) {
    while (have_posts()) {
        the_post();
        ?>
		<?php 
 include "includes/connect.php";
 include "includes/SimpleImage.php";
 include "include.php";
 if (isset($_POST['update'])) {
     $color_post = $_POST['color'];
     $coverpic_post = $_POST['coverpic'];
     date_default_timezone_set("Asia/Dhaka");
     $product_img_update_date = date('d-m-Y H:i:s a');
     //Returns IST
     $target2 = "asdf";
     if ($successimg == 1 && !empty($_POST['product_id'])) {
         $update_query = mysql_query("update product_image set image='{$target2}',color='{$color_post}',coverpic='{$coverpic_post}',image_update_date='{$product_img_update_date}' where id='{$update_id}'");
         if ($coverpic == 1) {
             $image_id = mysql_insert_id();
             if (!empty($image_id)) {
                 $cat_id = get_cat_id($product_id);
                 $status = 1;
                 $sql = mysql_query("update category_cover_pic set cat_id='{$cat_id}', product_id='{$product_id}', image_id='{$image_id}', update_date='{$update_date}', status='{$status}'");
                 $process_id = mysql_insert_id();
                 $update = mysql_query("update category_cover_pic set status=0 where cat_id={$cat_id} and id<>{$process_id}");
             }
         }
         if ($update_query) {
             echo "<script>alert('Post Published Successfully')</script>";
             echo "<script>window.open('view_productimage.php?page=1','_self')</script>";
         }
     } else {
         echo "value nei";
     }
 } else {
     echo "update e dhoke nai";
Пример #30
0
<div class="top">
<h3>Best Seller And Top Rated Product </h3>
<?php 
$featured_category = get_theme_option('featured_category_id1');
$category_id = get_cat_id($featured_category);
$category = get_cat_name($category_id);
$category_id = get_cat_id($featured_category);
$my_query = new WP_Query('cat=' . $category_id . '&' . 'offset=' . '&' . 'showposts=' . '5');
while ($my_query->have_posts()) {
    $my_query->the_post();
    $do_not_duplicate = $post->ID;
    $the_post_ids = get_the_ID();
    ?>
<div class="bestseller">
<div class="picbestseller">
<a href="<?php 
    the_permalink();
    ?>
" title="<?php 
    the_title();
    ?>
"><img src="<?php 
    echo getImage('1');
    ?>
"&amp;w=150&amp;h=120&amp;zc=0&amp;q=100" alt="<?php 
    the_title();
    ?>
"  width="150" height="100" /></a>
<div class="pictitle"><a href="<?php 
    the_permalink();
    ?>