Tagged: sidebar widget
-
AuthorPosts
-
February 25, 2016 at 10:41 pm #589501
In the sidebar widgets, we have it set up to display the items within the same category as the main item on the page. Is there a way to prevent that current page/item from appearing in list of items in the sidebar widget?
I searched the forums for an answer using various keyword combinations but couldn’t find anything specifically relevant…
This happens with Portfolio items, but also more generally…
Thanks!
February 29, 2016 at 3:14 am #590540Hi,
Can you please create us a WordPress administrator account? post it here as a private reply.
Regards,
JosueMarch 1, 2016 at 12:20 am #591254I thought I had replied already here…
We’re also having a problem editing any content inside a 4/5 column element within the Advanced Layout Editor on page indicated below in private
Thanks!!
-
This reply was modified 9 years, 8 months ago by
tcowin.
March 3, 2016 at 12:09 pm #592574Hi!
We added this code in the functions.php file:
add_action('pre_get_posts', 'ava_exclude_widget_post'); function ava_exclude_widget_post($query) { if (is_singular('portfolio')) { $exclude = avia_get_the_ID(); $query->set( 'post__not_in', array($exclude) ); } }Regards,
IsmaelMarch 3, 2016 at 7:19 pm #592826Thanks Ismael – if I wanted to make sure that the Posts behave the same way, I’m assuming I’d just modify the if statement like so: (?)
if (is_singular('portfolio') || is_singular('post'))?
March 4, 2016 at 1:15 pm #593247Hey!
Yes, I think that will do it. Please use this code instead:
add_action('pre_get_posts', 'ava_exclude_widget_post'); function ava_exclude_widget_post($query) { if (!is_admin() && is_singular('portfolio') || is_singular('post')) { $exclude = avia_get_the_ID(); $query->set( 'post__not_in', array($exclude) ); } }We added the is_admin conditional so that it won’t affect the dashboard.
Best regards,
Ismael -
This reply was modified 9 years, 8 months ago by
-
AuthorPosts
- You must be logged in to reply to this topic.
