Community Forums › Forums › Archived Forums › General Discussion › Column Classes affecting Sidebar
- This topic has 9 replies, 3 voices, and was last updated 7 years, 7 months ago by JPJP9.
-
AuthorPosts
-
August 7, 2016 at 9:43 pm #190894JPJP9Member
Hi,
I have the following code which is apply column classes to the sidebar and I can't work out how to make it stop TIA
function wt_grid_post_class( $classes ) { global $wp_query; if( !$wp_query->is_main_query()) return $classes; $columns = 3; $column_classes = array( '', '', 'one-half', 'one-third', 'one-fourth', 'one-fifth', 'one-sixth' ); $classes[] = $column_classes[$columns]; if( 0 == $wp_query->current_post % $columns ) $classes[] = 'first'; return $classes; } add_filter( 'post_class', 'wt_grid_post_class' );
August 8, 2016 at 6:26 am #190906Victor FontModeratorIn your first line you say this code "apply column classes to the sidebar". I don't see any reference to the sidebar in your code. I don't know how it can be applying anything to the sidebar. post_class is not a sidebar class. What am I missing?
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?August 8, 2016 at 5:59 pm #190939JPJP9MemberThe sidebar has the genesis sandbox featured content widget
August 8, 2016 at 7:35 pm #190942Victor FontModeratorThe Genesis Featured Sandbox widget is a third party plugin that is not supported on this site. I suspect you'd have to tie into one of it's many hooks. https://wordpress.org/plugins/genesis-featured-content-widget/faq/
This is a question best asked of the plugin author. https://wordpress.org/support/plugin/genesis-featured-content-widget
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?August 8, 2016 at 8:29 pm #190943JPJP9MemberI don't know that he will be very helpful seeing its specific to genesis column classes and I'm trying to leave the widget out of the equation so I don't think a hook would help.
I thought changing
if( !$wp_query->is_main_query() )
to
` if(!$wp_query->is_main_query() && is_post_type_archive()) 'but it doesn't work - not really sure what I'm doing
the query being targeted is for custom post type 'promotions'August 9, 2016 at 1:19 am #190948Sridhar KatakamParticipantTry this:
Create a template file called archive-promotions.php, cut the code from your first post and paste it between opening PHP tag and closing
genesis();
Does Genesis Featured Sandbox widget appear on your promotions CPT archive page as well?
August 9, 2016 at 7:25 pm #191007JPJP9MemberThe code is in archive-promotions.php The Genesis Featured Sandbox Widget is in the Primary Sidebar Widget.
Here is the sidebar
<aside id="genesis-sidebar-primary" class="sidebar sidebar-primary widget-area" itemtype="http://schema.org/WPSideBar" itemscope="" aria-label="Primary Sidebar" role="complementary"> <h2 class="genesis-sidebar-title screen-reader-text">Primary Sidebar</h2> <section id="featured-content-6" class="featured-content-upcoming-events featuredpost widget featured-content"> <div class="featured-content-upcoming-events featuredpost widget-wrap"> <h3 class="widgettitle widget-title">Upcoming Events</h3> <article class="post-263 news type-news status-publish has-post-thumbnail category-include-link-in-sidebar-events category-include-link-in-sidebar-news entry gs-1 gs-odd gs-featured-content-entry one-third" itemtype="http://schema.org/CreativeWork" itemscope=""> <article class="post-260 news type-news status-publish has-post-thumbnail category-include-link-in-sidebar-events entry gs-2 gs-even gs-featured-content-entry one-third" itemtype="http://schema.org/CreativeWork" itemscope="">
August 9, 2016 at 8:20 pm #191009Sridhar KatakamParticipantAugust 9, 2016 at 10:58 pm #191020JPJP9MemberI'm currently developing locally
August 14, 2016 at 7:01 pm #191281JPJP9MemberThe only way I could find to fix this problem was to apply the following css - which isn't an ideal solution but it worked
aside#genesis-sidebar-primary .one-third { width: 100%; }
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.