[Plugin: Add Links to Pages] Bug When Viewing Category Listing
-
I setup links on a specific post. However I have a menu which breaks down posts to different categories. So each menu item displays all posts in a specific category. The problem is if you check the page ID on that category listing page, you will notice it matches the post’s page ID. So now I have the widget showing a specific post’s links on the category page. Which is not the correct spot I want that showing on.
I looked into the code and found a quick fix for it. Here is the before and after…
in class-add-links-to-pages.php
function widget($args, $instance) { global $post; if(get_post_meta($post->ID, 'altp_links_html', true) != ''){ extract($args, EXTR_SKIP); echo $before_widget; $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']); if ( !empty( $title ) ) { echo $before_title . $title . $after_title; }; echo html_entity_decode( get_post_meta($post->ID, 'altp_links_html', true) ); echo $after_widget; } }
I added a check to see if it was a category page in the if block.
function widget($args, $instance) { global $post; if(get_post_meta($post->ID, 'altp_links_html', true) != '' && !is_category()){ extract($args, EXTR_SKIP); echo $before_widget; $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']); if ( !empty( $title ) ) { echo $before_title . $title . $after_title; }; echo html_entity_decode( get_post_meta($post->ID, 'altp_links_html', true) ); echo $after_widget; } }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘[Plugin: Add Links to Pages] Bug When Viewing Category Listing’ is closed to new replies.