Djoris Posted June 10, 2011 Share Posted June 10, 2011 I use the following code to output individual categories in the wordpress navigation: <?php echo preg_replace('@\<li([^>]*)>\<a([^>]*)>(.*?)\<\/a>@i', '<li$1><a$2>$3</a>',wp_list_categories('echo=1&orderby=id&title_li&include=1897')); ?> This works great and gives the output: <li class="cat-item cat-item-1897"><a href="http:www.test.org/category/category-name/">category</a></li> For some categories I would like to add ?gpc_sortby=views to the end of the url. Does anybody know how I can change the preg replace to get this right. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/239017-wordpress-list-categories-preg-replace/ Share on other sites More sharing options...
Djoris Posted June 15, 2011 Author Share Posted June 15, 2011 Anybody an idea or a hint where I can get such info? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/239017-wordpress-list-categories-preg-replace/#findComment-1229921 Share on other sites More sharing options...
Djoris Posted June 28, 2011 Author Share Posted June 28, 2011 This topic was moved out of the php coding help forum, although it isn't particulair a WP topic. Can anybody please help me? Quote Link to comment https://forums.phpfreaks.com/topic/239017-wordpress-list-categories-preg-replace/#findComment-1235768 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.