Stuck on legacy X & Cornerstone

I have not been able to update Cornerstone OR X for some time now.
X: You have version 8.3.3 installed. Update to 9.0.8.
Cornerstone: You have version 5.0.10 installed. Update to 6.0.8.

Both updates break my site.

I am using a child theme: Built 2016-11-11
The child theme includes a footer.php and functions.php

I am running PHP 7.4

Please recommend a path forward.

Hello @dwcouch,

Thanks for writing in! Have you made some heavy template customizations in your child theme? It is best that you switched to the parent theme before you update the X theme and Cornerstone plugin to 9.0.8 and 6.0.8 versions. We may need to check your child theme’s functions.php and the footer.php file as they may need to be relocated to different folders because it seems that you are using the legacy child theme. Please provide us access to your site so we can inspect the child theme. You can create a secure note in your next reply with the following info:
– Link to your site
– WP login URL
– WP username
– WP password
– WP Administrator Role
- Confirmation that we can access and make changes to your site

To know how to create a secure note, please check this out: How The Forum Works

Best Regards.

Hello @ruenell,
Thank you for your prompt reply.

I have not made heavy template customizations.
All customizations derive from either the functions.php or the footer.php files.

Modifications include:

functions.php

  • A function to specify the Child theme CSS
  • A function to add Blog Category descriptions after the breadcrumb and title divs.
  • A function to display recent post excerpts - provided by ThemeCo
  • A function to change the Read More button.

footer.php

  • A change to place Revolution Slider in the footer via PHP/Short-code

@ruenel
I did what you recommended and switched to the Parent theme to perform updates. The updates were successful. Switching back to the Child theme breaks the site.

Now I need to restore the styles, functions and footer mods I had in the child theme. What is the best way to add back-in the customizations I had?

Thank you.
~David

Another Update :slight_smile:
I have now installed the latest Child Theme for X from here: https://theme.co/docs/child-themes
And copied each function from the old child theme to the new child theme as well as my custom footer.php.

All went well except for the function built by ThemeCo to add excerpts to the recent posts widgets on the homepage. For now I have commented it out. Otherwise all functions, styles and the footer template have been re-implemented with the new child theme.

Here is the function that is no longer supported
PHP Error: function cs_get_raw_excerpt() does not exist.

/*  
 * Displaying Excerpt in Recent Posts
 * Recent Posts - revised by Themeco 4/21/2017
*/

function x_shortcode_recent_posts_v2code( $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 );

  $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(), 'entry-cropped' );
        $bg_image           = ( $image[0] != '' ) ? ' style="background-image: url(' . $image[0] . ');"' : '';
        $image_output       = '<div class="x-recent-posts-img"' . $bg_image . '></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="x-recent-posts-date">' . get_the_date() . '</span>'
                        . $excerpt
            . ' ... <span class="more-link">Read</span>'
                     . '</div>'
                   . '</div>'
                 . '</article>'
               . '</a>';

    endwhile; endif; wp_reset_postdata();

  $output .= '</div>';

  return $output;
}

add_action('wp_head', 'change_recent_posts_to_v2');

function change_recent_posts_to_v2() {
  remove_shortcode( 'x_recent_posts' );
  add_shortcode( 'x_recent_posts', 'x_shortcode_recent_posts_v2code' );
}

After further digging I see the shortcodes of old are still supported but that the new way is to build components with Cornerstone. I’ve approximated what we had before. The rollover behaviors are different. The class field is not working on the Title of the Meta element. And I am struggling in getting the image size to be the same proportions I had. This will have to do for now.

Hello @dwcouch,

Just for future topics, self responding or bumping your post pushes it back in our Queue system so it takes longer to respond to. We provide support to our customers 24/7/365 in the Support Forum. Support questions are answered in the order received and responses may take up to 24 hours (typically sooner). Complex questions or busy times may take longer.

1.) We have checked your child theme files. So that the child theme will not break your site, these are the changes that you need so :

  • You must rename footer.php into base.php
  • And then relocate the new base.php into this new location: wp-content/themes/x-child/framework/legacy/cranium/footers/views/footer/. You will have to create this folder path since it does not exist yet.

2.) As for the error " PHP Error: function cs_get_raw_excerpt() does not exist", this function has been deprecated and removed from the theme. We highly recommend that you remove the recent post shortcode and use the new Posts elements. Please do not worry about the styling because by using the new Posts elements, this element is editable. You can add more elements and dynamic contents into the new Posts element and even replicate the contents of your recent posts shortcode.

The new Posts element using Looper Provider, Looper Consumer, and dynamic contents to display the post items. If you will get familiar with these new features, for sure you will love it. Here’s the documentation that should be able to help you:

If you need more help in setting up the new Posts element, we can surely help you.

Thanks.

@ruenel Thanks for the follow up. I had for the most-part figured out the new builder in Cornerstone. I have since overidden new default hover functionality and other styles with CSS added to the Child theme. I have removed the custom recent posts function from functions.php

Also per your direction I renamed and moved footer.php.

Regarding the self-replies, etc. My efforts were not to bump this post to expedite any response as much as inform you of actions I had taken since reporting the issue. It only made sense to me to keep you appraised of what had changed since I reported the issue. Hopefully this little escapade will be of use to others. And hopefully these efforts have brought this theme to current and future updates will be less likely to break the site. Time will tell.

Thanks again for your assistance.
~David

Hi David,

Base on your response, it seems that you already figure it out! If you have any other concerns or clarifications regarding our theme features, feel free to open up a new thread.

Thank you.

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