Ethos spacing issue

Hiya


there is a load of text above the first section - any idea where it is coming from and how I can get rid of it?

And when it does go, is it possible to remove the space above the image so it lines up with the image in the side bar please.

And is it possible on this one page to get rid of the bit that says ‘HOME’
thank you!

Hi @lisacole1,

Thank you for reaching out to us.

  • To remove the top spacing from your homepage, add the following code in the Theme Options > CSS:
.home .x-container>.offset, .home .x-container .entry-content {
    margin-top: 0;
}
  • To remove the title, edit your homepage in Cornerstone, click on the Settings buttons (gear icon)

Then go to Page Settings and turn on the Disable Page Title option.

  • I checked your page and it looks like you’ve content in you homepage that has unclosed HTML tag, please check for any unclosed HTML tag and close it. If you still have problems kindly get back to us with URL/User/Pass of your WordPress dashboard using the Secure Note functionality of the post to follow up the case.

Thanks!

thank you, I didn’t know those page settings existed! A whole new world has opened up!

Is there a way to find the HTML? All I can see are the Cornerstone elements.

And when that text has gone, can the top image line up with the top of the sidebar but I still need a bit of margin on the sidebar top so that the title of the widget has some space around it.

Hello Lisa,

Thanks for updating the thread.

Regarding HTML, I suggest you to check the elements that’s added on the editor and look for any unclosed tags. I see that you have changed the values of the code that was given by my colleague. However, in that I see a syntax error. Please update the code from:

.home .x-container>.offset, .home .x-container .entry-content {
    margin-top: 10;
}

To

.home .x-container>.offset, .home .x-container .entry-content {
    margin-top: 10px;
}

Here are some related links for further reading:

Hope this helps.

thank you!
I genuinely cannot see any code on the page, just the sections and elements within them. I’ve checked everyone I can for any errors in the text editor where I can, but still nothing. Would you mind having a look at it please. I have run out of ability here because I cannot get behind the cornerstone stuff.

Hi,

I checked your homepage in cornerstone and can’t find those text too. A plugin could be adding it.

Can you try deactivating all plugins except cornerstone, and seeing if the problem remains. If it’s fixed, you’ll know a plugin caused the problem, and you can narrow down which one by reactivating them one at a time.

If that doesn’t help, try activating your parent theme to check if it is some code in your child theme that is causing the issue.

Thanks

good idea, thank you!
I disabled all the plugins apart from cornerstone and that text was still there
I tried it on the main theme and it had gone
so it is somewhere in the child theme
I have edited the functions php which usually results in the end of the world, have I done something wrong there?

 <?php

// =============================================================================
// FUNCTIONS.PHP
// -----------------------------------------------------------------------------
// Overwrite or add your own custom functions to X in this file.
// =============================================================================

// =============================================================================
// TABLE OF CONTENTS
// -----------------------------------------------------------------------------
//   01. Enqueue Parent Stylesheet
//   02. Additional Functions
// =============================================================================

// Enqueue Parent Stylesheet
// =============================================================================

add_filter( 'x_enqueue_parent_stylesheet', '__return_true' );



// Additional Functions
// =============================================================================

// Custom Recent Post
// =============================================================================

function x_shortcode_recent_posts_v2( $atts ) {
  extract( shortcode_atts( array(
    'id'           => '',
    'class'        => '',
    'style'        => '',
    'type'         => 'post',
    'count'        => '',
    'category'     => '',
    'offset'       => '',
    'orientation'  => '',
    'no_sticky'    => '',
    'no_image'     => '',
    'fade'         => ''
  ), $atts, 'x_recent_posts' ) );

  $allowed_post_types = apply_filters( 'cs_recent_posts_post_types', array( 'post' => 'post' ) );
  $type = ( isset( $allowed_post_types[$type] ) ) ? $allowed_post_types[$type] : 'post';

  $id            = ( $id           != ''     ) ? 'id="' . esc_attr( $id ) . '"' : '';
  $class         = ( $class        != ''     ) ? 'x-recent-posts cf ' . esc_attr( $class ) : 'x-recent-posts cf';
  $style         = ( $style        != ''     ) ? 'style="' . $style . '"' : '';
  $count         = ( $count        != ''     ) ? $count : 3;
  $category      = ( $category     != ''     ) ? $category : '';
  $category_type = ( $type         == 'post' ) ? 'category_name' : 'portfolio-category';
  $offset        = ( $offset       != ''     ) ? $offset : 0;
  $orientation   = ( $orientation  != ''     ) ? ' ' . $orientation : ' horizontal';
  $no_sticky     = ( $no_sticky    == 'true' );
  $no_image      = ( $no_image     == 'true' ) ? $no_image : '';
  $fade          = ( $fade         == 'true' ) ? $fade : 'false';

  $js_params = array(
    'fade' => ( $fade == 'true' )
  );

  $data = cs_generate_data_attributes( 'recent_posts', $js_params );

  $output = "<div {$id} class=\"{$class}{$orientation}\" {$style} {$data} data-fade=\"{$fade}\" >";

    $q = new WP_Query( array(
      'orderby'             => 'date',
      'post_type'           => "{$type}",
      'posts_per_page'      => "{$count}",
      'offset'              => "{$offset}",
      "{$category_type}"    => "{$category}",
      'ignore_sticky_posts' => $no_sticky
    ) );

    if ( $q->have_posts() ) : while ( $q->have_posts() ) : $q->the_post();

      if ( $no_image == 'true' ) {
        $image_output       = '';
        $image_output_class = 'no-image';
      } else {
        $image              = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full' );
        $image_output       = '<div class="x-recent-posts-featured"><img src="' .$image[0] .'"></div>';
        $image_output_class = 'with-image';
      }

      $excerpt = ( $show_excerpt ) ? '<div class="x-recent-posts-excerpt"><p>' . preg_replace('/<a.*?more-link.*?<\/a>/', '', cs_get_raw_excerpt() ) . '</p></div>' : '';

      $output .= '<a class="x-recent-post' . $count . ' ' . $image_output_class . '" href="' . get_permalink( get_the_ID() ) . '" title="' . esc_attr( sprintf( csi18n('shortcodes.recent-posts-permalink'), the_title_attribute( 'echo=0' ) ) ) . '">'
                 . '<article id="post-' . get_the_ID() . '" class="' . implode( ' ', get_post_class() ) . '">'
                   . '<div class="entry-wrap">'
                     . $image_output
                     . '<div class="x-recent-posts-content">'
                       . '<h3 class="h-recent-posts">' . get_the_title() . '</h3>'
		               . '<span class="recent-posts-author">' .the_author() . '</span>'
                       . '<span class="x-recent-posts-date">' . get_the_date() . '</span>'
                     . '</div>'
                   . '</div>'
                 . '</article>'
               . '</a>';

    endwhile; endif; wp_reset_postdata();

  $output .= '</div>';

  return $output;

}

add_filter('wp_head', 'x_recent_posts_excerpt');

function x_recent_posts_excerpt() {
  remove_shortcode( 'x_recent_posts' );
  remove_shortcode( 'recent_posts' );
  add_shortcode( 'x_recent_posts', 'x_shortcode_recent_posts_v2' );
  add_shortcode( 'recent_posts', 'x_shortcode_recent_posts_v2' );
}

HI Lisa,

I tried to trace where the text is coming from but I can’t seem to find it. Did you happen to add any customization to the other files of the child theme? If you are not able to find it, kindly provide us with your FTP details so that we can try to check this further.

Thank you.

thanks, I only added the code to the functions file, thank you so much for looking for me!

Hey Lisa,

Though the text displaying in the frontend is nowhere to be found in the code, it’s the code that is outputting it. As you can see, the text is repeatedly taken from the author display.

Maybe the custom code worked in the past but it’s no longer compatible with the latest version of X and Cornerstone. Please remove it and I’d recommend that you instead use one of the grid plugins bundled in our theme instead of modifying the Recent Post element which is not recommended.

I understand that maybe you got the code from us but I’m sorry it wasn’t made clear that customizations could break your site especially in the future. Custom codes are only provided here for guidance or to help users who have web development knowledge get started customizing our products.

Custom codes need to be updated or maintained and it’s not feasible to keep track of them and for us to provide maintenance service. Updates are only provided for the products and not custom code.

Please use either one of the bundled grid plugins instead as they provide more options than the Recent Post element. For more details, please visit the links below.

Thanks.

Thank you so much. I didn’t understand about the code becoming obsolete.
It isn’t a problem, we just need to make sure the featured images are the right size to look good.
Do you have a recommended dimension to work to?

Hello Lisa,

There might be some part of the code that was outdated. Please try to use this:

// Custom Recent Post
// =============================================================================

// Recent Posts
// =============================================================================

function x_shortcode_recent_posts_v2( $atts ) {
  extract( shortcode_atts( array(
    'id'           => '',
    'class'        => '',
    'style'        => '',
    'type'         => 'post',
    'count'        => '',
    'category'     => '',
    'offset'       => '',
    'orientation'  => '',
    // 'show_excerpt' => 'true',
    'no_sticky'    => '',
    'no_image'     => '',
    'fade'         => ''
  ), $atts, 'x_recent_posts' ) );

  $allowed_post_types = apply_filters( 'cs_recent_posts_post_types', array( 'post' => 'post' ) );
  $type = ( isset( $allowed_post_types[$type] ) ) ? $allowed_post_types[$type] : 'post';

  $id            = ( $id           != ''     ) ? 'id="' . esc_attr( $id ) . '"' : '';
  $class         = ( $class        != ''     ) ? 'x-recent-posts cf ' . esc_attr( $class ) : 'x-recent-posts cf';
  $style         = ( $style        != ''     ) ? 'style="' . $style . '"' : '';
  $count         = ( $count        != ''     ) ? $count : 3;
  $category      = ( $category     != ''     ) ? $category : '';
  $category_type = ( $type         == 'post' ) ? 'category_name' : 'portfolio-category';
  $offset        = ( $offset       != ''     ) ? $offset : 0;
  $orientation   = ( $orientation  != ''     ) ? ' ' . $orientation : ' horizontal';
  // $show_excerpt  = ( $show_excerpt == 'true' );
  $no_sticky     = ( $no_sticky    == 'true' );
  $no_image      = ( $no_image     == 'true' ) ? $no_image : '';
  $fade          = ( $fade         == 'true' ) ? $fade : 'false';

  $js_params = array(
    'fade' => ( $fade == 'true' )
  );

  $data = cs_generate_data_attributes( 'recent_posts', $js_params );

  $posts = get_posts( array(
    'orderby'             => 'date',
    'post_type'           => "{$type}",
    'posts_per_page'      => "{$count}",
    'offset'              => "{$offset}",
    "{$category_type}"    => "{$category}",
    'ignore_sticky_posts' => $no_sticky
  ) );

  $output = "<div {$id} class=\"{$class}{$orientation}\" {$style} {$data} data-fade=\"{$fade}\" >";

    foreach ($posts as $post) {

      if ( $no_image == 'true' ) {
        $image_output       = '';
        $image_output_class = 'no-image';
      } else {
        $image              = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
        $image_output       = '<div class="x-recent-posts-featured"><img src="' .$image[0] .'"></div>';
        $image_output_class = 'with-image';
      }

      $output .= '<a class="x-recent-post' . $count . ' ' . $image_output_class . '" href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( csi18n('shortcodes.recent-posts-permalink'), the_title_attribute( array( 'echo' => false, 'post' => $post->ID ) ) ) ) . '">'
                 . '<article id="post-' . $post->ID . '" class="' . implode( ' ', get_post_class('', $post->ID) ) . '">'
                   . '<div class="entry-wrap">'
                     . $image_output
                     . '<div class="x-recent-posts-content">'
                       . '<h3 class="h-recent-posts">' . get_the_title( $post->ID ) . '</h3>'
                       . '<span class="x-recent-posts-date">' . get_the_date( '', $post->ID ) . '</span>'
                     . '</div>'
                   . '</div>'
                 . '</article>'
               . '</a>';

    }

  $output .= '</div>';

  return $output;
}

add_filter('wp_head', 'x_recent_posts_excerpt');

function x_recent_posts_excerpt() {
  remove_shortcode( 'x_recent_posts' );
  remove_shortcode( 'recent_posts' );
  add_shortcode( 'x_recent_posts', 'x_shortcode_recent_posts_v2' );
  add_shortcode( 'recent_posts', 'x_shortcode_recent_posts_v2' );
}

Kindly note that since this is a custom code that changes the default behavior/display of the theme, you will be responsible to maintain or update the code in case you require further changes or if the code stops working in future updates.

Cheers!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.