get_category_link from a Theme Options variable
-
I am developing a theme that uses theme options to populate the Home page with a custom query. I would also like to have a link back to the admin’s chosen category so you can browse the archives. I am using
<?php echo get_category_link( $category[0]->cat_ID ); ?>which is fine if all of the posts are in the selected category. But, if a post resides in multiple categories, this fails. If there a way I can get the category link within my custom query based on the theme option chosen? Here is the query I came up with. Any and all help is truly appreciated.<?php $block_one = new WP_Query('category_name='. get_option('wap8_block1') .'&showposts=1&caller_get_posts=1'); while ( $block_one -> have_posts() ) : $block_one -> the_post(); $category = get_the_category(); ?>
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
The topic ‘get_category_link from a Theme Options variable’ is closed to new replies.