Modern's Huge Upgrade Renders my Child-Themed Site Unusable

Home Forums Modern Modern's Huge Upgrade Renders my Child-Themed Site Unusable

Viewing 10 posts - 1 through 10 (of 15 total)
  • Author
    Posts
  • #17111

    hiraag
    Participant

    Modern's Huge Upgrade Renders my Child-Themed Site Unusable

    Resolved

    I am a fan of your Modern theme and I appreciate it being free.

    I understand the need for you to upgrade it to enhance it, keep up with the time, etc..

    I was on v1.4.6 and I was prompted to upgrade which I did. But the site became unusable because I had put a few files in my child theme such as _front_page.php and header.php. I was able to fix header.php, but I can’t even find _front_page.php in your new structure to copy its modifications into my custom file. This error was encountered, but I don’t know where to modify and fix the issue.

    Uncaught Error: Call to undefined function wm_schema_org() in .../wp-content/themes/modern-child/_hh_front_page2.php:80

    My decision for now is to recover from a backup or reinstall the old version. We shall see. Would it be okay if I just skip upgrade? No security issues if I do so?

    Keep up the awesome work!

    • This topic was modified 2 months, 1 week ago by  Oliver Juhas. Reason: Formatting code
    #17114

    Oliver Juhas
    Keymaster

    Hi hiraag,

    First, thank you, I’m glad you like the theme! :)

    Modern theme was long in the queue for update (more than 2 years!) so I went ahead and upgraded it to new accessibility ready framework I built and use nowadays. Surely, this may cause issues with any child theme.
    Due to PHP error you might have even not seen the upgrade notifications in your WP admin. However, I’ve provided upgrade info on my Facebook page (I suggest to subscribe as I provide update info on social networks, either on Facebook or Twitter).

    I strongly suggest not to skip any updates, but rather downgrade the theme to previous version 1.4.6, then fix your child theme in localhost environment and finally update the Modern theme on your live website and upload your fixed child theme using FTP. Please read information about child theme in theme documentation.

    To let you know, the header.php and page-template/_front.php (did you mean this one as there was never a _front_page.php file in the theme) location has not changed as that would cause much more issues. The files were only updated.

    However, I strongly recommend using hooks instead of editing files in your child theme. There is really no need for that in most cases as you can control almost everything in the theme using hooks. That way your child theme may contain on 1 PHP file, the functions.php and your child theme becomes much more future proof.

    You can ask here at the support forum and describe how would you like to edit the files so I can provide you tips on what to do (please note that I do not provide full support for theme modifications – please read terms of service).

    The PHP error was caused by the not-existing function found in your child theme files. The wm_schema_org() function was removed in newest Modern theme version as I decided to leave the microformats markup for plugins, which is much more flexible solution. You can just remove the function from your child theme code.

    Best regards,

    Oliver Juhas
    WebMan Design

    #17115

    Oliver Juhas
    Keymaster

    Also, please read the theme’s changelog.md file for list of changes in the theme versions.

    Best regards,

    Oliver Juhas
    WebMan Design

    #17140

    hiraag
    Participant

    Hi Oliver,

    I just wanted to give you a quick update in my saga (with one of 2 sites using Modern, I have not attempted the second site) I spent inordinate amount of time to upgrade my modern child and was not able to see the light at the end of the tunnel.

    I just restored from backup from the day before I upgraded. I totally understand that you did what you had to do. Perhaps I had too much of weird customizations that can’t be ported to 2.0/2.0.1. If I knew that I can solve this problem by investing one additional day, I would but I can’t see that happening. I hope I have no security problems if I keep my two sites at 1.4.6.

    Thank you very much for going out of you way to detail some solutions for me.

    #17145

    Oliver Juhas
    Keymaster

    Hi hiraag,

    Maybe you can ZIP your child theme and attach it here, in your response, so I can have a look at it (if it’s not too large) and give you some tips?

    I believe any customization can be ported to new theme version.

    Best regards,

    Oliver Juhas
    WebMan Design

    #17158

    hiraag
    Participant

    Hi Oliver,

    Thanks so much for this gracious offer. I guess I have to take you up on it (attached the zipped child theme.) I hope I am not too much of a burden on you. I have attached zipped file here, but I marked unused stuff as “NON USED..” at the start of file/folder name to save you spending time on somethings that I had experimented with such things as integrating with SalesForce app.

    I am guilty of not following your framework based customization based solely on hooks and by creating custom templates and such. This experience does not affect my love for your theme. In fact it strengthened it since I know you are working hard on improving it. I know I will use this theme in my future projects.

    I promise to put in my future customizations of the theme only though the hooks you went out of your way to provide. My lack of experience in theme eco system is partly to blame. My second site that uses Modern is just a copy of my child theme that I attached. I can apply the changes to it once I know my errors from the first one.

    Again, I owe you my friend!

    • This reply was modified 2 months ago by  Oliver Juhas. Reason: Making the reply public as there is no sensitive information, deleting attachment
    #17162

    Oliver Juhas
    Keymaster

    Hi hiraag,

    Here is my output on your child theme:

    • Removed not-used files and files you no longer need, such as site info custom text (see theme options info below).
    • I commented out your CSS styles in style.css file as it does not relate to functionality I was checking. Feel free to remove the comments around your CSS styles to reintroduce them back – please go through those styles, as a lot have changed in the new theme version and your custom styles might not work as intended now. I have also removed some of those styles for you (and the ones that were commented out anyway) as they are not needed any more, but you need to go through them all to make sure they are OK.
    • I’ve updated your child theme code to match https://github.com/webmandesign/child-theme
    • If you have Jetpack plugin installed, you can check the Content Options in Appearance → Customize as I’ve seen you are trying to hide post publish date, for example.
    • You can now set custom site info (copyright) text in Appearance → Customize → Theme Options → Texts.
    • You can now fully control theme colors in Appearance → Customize → Theme Options.
    • I can also see you have setup.php file in the root of your child theme. I have removed this file as it wasn’t used anyway. If you want to override a parent theme file, you need to keep the folder structure in your child theme too. However, in new theme version it won’t work either for the includes/setup/class-setup.php file as you should use hooks instead of overriding the whole file.
    • I can see you are modifying header.php only to add Google Analytics code. Please understand this is really not necessary. I have removed the header.php file from your child theme as there are plugins your can use to add GA code (actually, even Jetpack added support for GA already, so you can use that one if you want).
    • Again, I’ve removed unused code from your child theme‘s functions.php file and I’ve put code comments there if needed.
    • Not sure why you’ve tried to override the content-featured-post.php file in your child theme as it was identical to the file in previous theme version, so there was no custom functionality in there… I’ve removed the file so.
    • I’m not quite sure what you wanted to do in content-custom-header.php file. It seems like you removed the custom header (intro section) inner elements, but left the empty containers. Did you want to remove the intro section entirely? If so, you can do that in current theme version using this code:
      function modern_child_setup() {
      	add_filter( 'wmhook_modern_intro_disable', '__return_true' );
      }
      add_action( 'after_setup_theme', 'modern_child_setup', 100 );
    • For your custom front page template (the _hh_front_page2.php file) I can see you wanted to:
      1. hide portfolio projects,
      2. display specific posts only,
      3. and hide the static front page content.

      All of these lead me to believe you do not need to use a custom page template at all. And you do not need to use a static front page (homepage) either.
      You are only displaying posts on your front page, as far as I understand, so you should leave it display your latest posts, which is the WordPress default setting. Then just use a plugin to specify a category displayed on your blog homepage, such as https://wordpress.org/plugins/front-page-category/, for example.
      I went ahead and removed the _hh_front_page2.php file from your child theme.

    As you can see, you are left out with only a functions.php and styles.css file in your child theme. There really is nothing else needed ;)

    You can download your new child theme at https://www.dropbox.com/s/f8unyny4s7i1uof/modern-child-edited-by-oliver.zip?dl=1 – please, let me know ones you download it so I can delete it.

    Best regards,

    Oliver Juhas
    WebMan Design

    #17165

    Oliver Juhas
    Keymaster

    Also, as the theme uses Theme Hook Alliance action hooks, you may want to use https://wordpress.org/plugins/tha-hooks-interface/ plugin. However, I strongly suggest using actual PHP code in your child theme instead.

    Best regards,

    Oliver Juhas
    WebMan Design

    #17168

    hiraag
    Participant

    Hi Oliver,

    I can’t tell you how grateful I am of you for taking time to do this analysis and provide me with guidance.

    I promise to follow your advice and do everything possible to bring my child them to a properly compliant state for the upgrade.

    I will be sure to keep you updated. I plan to get back to it in the next day or so.

    Thanks
    Girma

    • This reply was modified 2 months ago by  Oliver Juhas. Reason: Making the reply public as there is no sensitive information
    #17275

    hiraag
    Participant

    Hi Oliver,

    Happy New Year and I hope you had a good holiday season!

    I finally got to work on my Modern child theme upgrade per your guidance. I had to do it because that is the least I can do when you graciously gave me your time and guidance.

    As you suggested, I got rid of all custom files except couple that I had to create: 1) I had to use modern-child/template-parts/intro/intro-media.php only to get rid of the intro from non-home page pages by adding || !is_front_page() to the first if statement 2) /modern-child/template-parts/loop/loop-front-blog.php to modify home page query (you are correct I did not have to use custom _front.php). Note that my home page has certain posts I have to show on top and in a particular order too. You have such function in ‘featured’ posts, but I could not manipulate the order of posts that appear.

    I am done now and it looks good. To be completely honest, I wanted to get out of upgrading when it good too much tweaking to get what I had before. As I mentioned above, it was the fact that you generously gave me your time that kept me in it. I did now want to let you down.

    One last thing I am struggling with is the fact that in post list view (cards view), the image does not show in the card unless the post format is image gallery or video gallery whether or not I set image as part of post or use featured image (or both.)

    If the image is set as featured image it doesn’t even show the image in single post view at the top of the post. I might be doing something stupid, but it is just taking me forever. In your demo site you show the images correctly in the cards. I am not sure what is going on. It shows the image when you set the image at the top of the post as part of your post although not striking (100% of its container div) image as before. I am unable to change that to 100% with a css. I welcome your suggestion on that too :)

    Side Note: You may have to think about showing images by default for all post formats in the card. The point about the card is really the attractiveness you can create with it. Just a polite suggestion.

    Your customization tip on making this happen for all post formats is also appreciated.

    Thanks

    • This reply was modified 1 month, 2 weeks ago by  Oliver Juhas. Reason: Making the reply public as there is no sensitive information
Viewing 10 posts - 1 through 10 (of 15 total)

You must be logged in to reply to this topic.