-
AuthorPosts
-
February 29, 2016 at 2:38 am #590525
The <main> wrap and <div> wrap for the page/post is empty if the first element on the page is a color section or grid row. I have not tested every element so it may occur with others.
HTML output
<div class="main_color container_wrap_first container_wrap fullsize"><div class="container"><main role="main" itemprop="mainContentOfPage" class="template-page content av-content-full alpha units"><div class="post-entry post-entry-type-page post-entry-38"><div class="entry-content-wrapper clearfix"></div></div></main><!-- close content main element --></div></div> <div id="av_section_1" class="avia-section orange_section_color avia-section-default avia-no-shadow avia-bg-style-scroll container_wrap fullsize"><div class="container"><div class="template-page content av-content-full alpha units"><div class="post-entry post-entry-type-page post-entry-38"><div class="entry-content-wrapper clearfix"> <div class="flex_column av_one_full flex_column_div first "><div style="padding-bottom:10px;" class="av-special-heading av-special-heading-h3 "><h3 class="av-special-heading-tag" itemprop="headline">Hello</h3><div class="special-heading-border"><div class="special-heading-inner-border"></div></div></div> <section class="av_textblock_section" itemscope="itemscope" itemtype="https://schema.org/CreativeWork"><div class="avia_textblock " itemprop="text"><p>Click here to add your own text</p> </div></section></div></div></div></div><!-- close content main div --> <!-- section close by builder template --></div><!--end builder template--></div>
February 29, 2016 at 5:23 pm #590965Hey!
Try enabling debug mode an check there are no elements or whitespace before the section shortcode.
Regards,
JosueFebruary 29, 2016 at 8:47 pm #591082The shortcodes seem fine. Any other ideas as to what could be going on?
February 29, 2016 at 8:50 pm #591090Does it happen to every Page or just that one? try creating more Color Sections (before/after) and check if it gets fixed.
February 29, 2016 at 9:00 pm #591100Creating more color sections did not help. However, it does seem to be happening only to this page, which is odd because there is no special page template in use. I deleted and re-created the page and the problem disappeared.
Could it have been related to a theme update? The page existed prior to the most recent version of the theme.
February 29, 2016 at 9:05 pm #591106Not sure, i’ve seen this bug before but i couldn’t really tell what causes it to be honest (the fix is normally re-creating the Page or adding/removing sections), in any case if it happens again don’t hesitate to report it here
Regards,
JosueJanuary 14, 2020 at 6:19 pm #1173534Hi Josue,
it just happened to me on my homepage…
I have a color section at start, but it does not happen on another page also with color section…see the capture of the inspector below
January 14, 2020 at 9:49 pm #1173663Hi nordtheme,
Can you give us temporary admin access to your website in the private content box below, so that we can have a closer look?
Best regards,
VictoriaJanuary 15, 2020 at 10:24 am #1173883Hi Victoria,
I can’t right now, cause i’m developing locally. But I found something: it happens when I use a shortcode and only if in the shortcode I loop a query.this is my shortcode code:
/** * SHORTCODE * * Get listing of [num] news items (homepage) * * @param array $atts * the attributes of short code (contains the number of posts to load) * defaults to 5 items * * @return string */ function getNewsBloc( $atts ) { $count = 5; if ( isset( $atts['count'] ) ) { $count = $atts['count']; } $args = array( 'posts_per_page' => $count, 'post_type' => 'news', 'meta_key' => 'date', 'orderby' => 'meta_value', 'post_status' => 'publish', 'order' => 'DESC' ); $my_query = new WP_Query( $args ); $strHtml = '<section><ul class="news-list">'; // if ( $my_query->have_posts() ) { // while ( $my_query->have_posts() ) { // $my_query->the_post(); $strHtml .= '<li>'; $strHtml .= '<a href="' . get_the_permalink() . '">'; $strHtml .= '<span class="date">' . get_field( 'date' ) . '</span>'; $strHtml .= get_the_title(); $strHtml .= '</a>'; $strHtml .= '</li>'; // } // } $strHtml .= '</ul>'; $strHtml .= '<a class="arrow-right" href="/news">More news</a></section>'; return $strHtml; } add_shortcode( "news-bloc", "getNewsBloc" );
As you see, I commented out the loop and then it’s right in the wrapper. As soon as I uncomment the loop, it takes all content out of div wrap_all
Any idea about what I’m doing wrong here ?
Thanks
January 17, 2020 at 12:19 pm #1175329Hi nordtheme,
I have checked it on my end and uncommented the loop and commented out this part since I don’t have acf installed:
$strHtml .= '<span class="date">' . get_field( 'date' ) . '</span>';
And it seems to work properly on my end.
Can you give us temporary admin access and ftp access? so we can check further.
Just post the credentials in private content.Best regards,
NikkoJanuary 21, 2020 at 10:32 am #1176639hi Nikko,
thanks for the update. I soon will put the website on dev online server, so I’ll make you an access and come back to you.Best regards
January 21, 2020 at 10:48 am #1176647Hi,
Right before return try to add the following:
wp_reset_postdata();
With $my_query->have_posts() you alter the main query and this seems to break the everything.
I would recommend not to use the WP loop for secondary queries but create your own loop using foreach and $my_query->posts.
Best regards,
GünterJanuary 21, 2020 at 11:06 am #1176651hm this one sounded promising, so I just tested it, and the reset_postdata did it! Cool!!
Now I’ll try to change it all to make my own loop as you suggest
Thanks Günter!
January 21, 2020 at 11:46 am #1176659 -
AuthorPosts
- You must be logged in to reply to this topic.