deepak-rajpal
9/3/2015 - 3:40 PM

WordPress Snippets Collection - Best and Tested

WordPress Snippets Collection - Best and Tested

<?php
  $column_items = ceil($column_items); // round off to nearest above value
?>
<?php 
	// Getting main applications category link by slug.
	// Not in use because adding 'blog' in category link url as well as we need actually app page url.
	/* $category_data = get_category_by_slug('applications');
	$category_link = get_category_link( $category_data->term_id); */

    // Get the URL of category with slug applications
		$category_data = get_category_by_slug( 'applications' );
		$category_link = get_category_link( $category_data->term_id );
?>
		<a href="<?php echo $category_link; ?>"> Click to go to Applications Category </a>
<?php
/* Get First WordPress Category Link, Slug and Name*/
$category = get_the_category(); 
	$category_name = $category[0]->cat_name;
	$category_link = get_category_link($category[0]->term_id);
	$category_slug = $category[0]->slug;
?>