Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #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.

    Layout Builder Screenshot
    Result

    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>
    #590965

    Hey!

    Try enabling debug mode an check there are no elements or whitespace before the section shortcode.

    Regards,
    Josue

    #591082

    The shortcodes seem fine. Any other ideas as to what could be going on?

    Debug mode content

    #591090

    Does it happen to every Page or just that one? try creating more Color Sections (before/after) and check if it gets fixed.

    #591100

    Creating 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.

    #591106

    Not 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,
    Josue

    #1173534

    Hi 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

    capture

    #1173663

    Hi 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,
    Victoria

    #1173883

    Hi 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

    #1175329

    Hi 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,
    Nikko

    #1176639

    hi 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

    #1176647

    Hi,

    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ünter

    #1176651

    hm 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!

    #1176659

    Hi,

    Glad we could help you.

    Enjoy the theme and feel free to come back if you need further assistance.

    Best regards,
    Günter

Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.