Link to post not working correctly
-
Hey all,
I am generating links for a group of pages that have the same name as Categories using this method –
if(is_page(69) || is_array($cat) && in_array(38, $cat)){ $categories = get_categories('child_of=38'); $otherService1 = get_permalink(155); echo '<li><h2 class="staffList_bcg_active">Individuals</h2><ul>'; if(!empty($categories)){ foreach ($categories as $cat) { $post_id = $wpdb->get_var('SELECT post_name FROM wp_posts WHERE post_title="'.$cat->cat_name.'"'); $allLinks = '<li><a href="https://www.dynedrewett.com/'.$post_id.'">'.$cat->cat_name.'</a></li>'; echo $allLinks; } } echo '</ul></li>'; echo '<li><h2 class="staffList_bcg_normal"><a href="'.$otherService1.'">Businesses</a></h2></li>'; }
While the list dispalys correctly and the mojority of the posts work, there is one that will not link correctly. It should create the link if ‘https://www.dynedrewett.com/disputes’, but it does not and instead creats ‘https://www.dynedrewett.com/297-revision-3’, with 297 being the Post_ID and revision 3 being the latest revision. I cannot think of what chould be causing this, so any help is appricated.
Thanks.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Link to post not working correctly’ is closed to new replies.