<?php
echo get_cat_name( $catID )
?>
Wordpress
<?php
echo get_cat_name( $catID )
?>
<?php
function getCurrentCatID(){
global $wp_query;
if(is_category() || is_single()){
$cat_ID = get_query_var(‘cat’);
}
return $cat_ID;
}
echo $getCurrentCatID();
?>
<?php
$content = get_the_content();
echo substr(strip_tags($content), 0, 100);
?>
<?php
foreach((get_the_category(POST-ID)) as $category) {
echo $category->cat_name;
}
?>
The below given code will list all the values added to the given fields
<?php
$custom_fields = get_post_custom(POST_ID);
$fieldsValue = $custom_fields[‘FIELD’];
foreach ( $fieldsValue as $key => $value )
echo $value . “<br />”;
?>
if (function_exists(‘register_sidebar’)) {
register_sidebar(array(
‘name’=> ‘Header Area’,
‘id’ => ‘top_tabs’,
‘before_widget’ => ‘<li id=”%1$s”>’,
‘after_widget’ => ‘</li>’,
‘before_title’ => ‘<h2>’,
‘after_title’ => ‘</h2>’,
));
}
<?php
// ‘links’ is the slug name of the link category link
$linkeQry=”SELECT * FROM wp_links as link INNER JOIN wp_term_relationships ON (link.link_id = wp_term_relationships.object_id)
INNER JOIN wp_term_taxonomy ON (wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id) AND wp_term_taxonomy.taxonomy = ‘link_category’
INNER JOIN {$wpdb->prefix}terms as c ON c.term_id=wp_term_taxonomy.term_id
WHERE c.slug=’links'”;
$linksData = $wpdb->get_results($linkeQry);
?>
<ul>
<?php foreach($linksData as $key=>$link) { ?>
<li><a href=”<?php echo $link->link_url; ?>” target=”_blank”><?php echo $link->link_name; ?></a></li>
<?php } ?>
</ul>
<?php
$linkeQry=”SELECT * FROM $wpdb->links”;
$linksData = $wpdb->get_results($linkeQry);
?>
<ul>
<?php foreach($linksData as $key=>$link) { ?>
<li><a href=”<?php echo $link->link_url; ?>” target=”_blank”><?php echo $link->link_name; ?></a></li>
<?php } ?>
</ul>
<?php if (is_user_logged_in()){?>
<li><a href=”<?php bloginfo(‘url’); ?>/wp-admin”>Site Admin</a></li>
<li><a href=”<?php bloginfo(‘url’); ?>/wp-login.php?action=logout&_wpnonce=f17bcd0114″>Log out</a></li>
<?php } else { ?>
<li><a href=”<?php bloginfo(‘url’); ?>/wp-login.php”>Log in</a></li>
<?php }; ?>
<?php
get_year_link( $year );
?>