Tagged: x
-
AuthorPosts
-
July 9, 2016 at 4:00 pm #1079552
I am editing this php file here: http://pastebin.com/VuH3C1XH
Line 54. I need to replace this line with this code:
<?php if (is_user_logged_in ()): ?> <?php $current_user = wp_get_current_user (); echo get_avatar ($current_user->user_email, 100); ?> <?php else: ?> <img src="http://richtrix.com/wp-content/uploads/2016/07/Register.jpg" alt="No avatar is available" /> <?php endif; ?>
I edited this on my parent theme (bad, I know) and the changes worked perfectly. I undid the changes and went to my child theme to implement this edit.
Problem is, no matter how I edit my child theme functions.php, my website breaks down. Can someone please assist me in the correct way to make this edit?
I would be so grateful! I am driving myself insane trying to do this (wordpress.org directed me here).
Jeff Arnold
July 10, 2016 at 1:30 am #1079914Hello Jeff Arnold,
Thanks for writing in! There is a typographic error in your code. You can make use of this code instead:
<?php if ( is_user_logged_in() ) : ?> <?php $current_user = wp_get_current_user(); echo get_avatar($current_user->user_email, 100); ?> <?php else : ?> <img src="http://richtrix.com/wp-content/uploads/2016/07/Register.jpg" alt="No avatar is available" /> <?php endif; ?>
We would loved to know if this has work for you. Thank you.
July 10, 2016 at 3:45 pm #1080480I endlessly get the same old error message over and over again:
Parse error: syntax error, unexpected ‘<‘ in /home2/rftm/public_html/richtrix.com/wp-content/themes/x-child/functions.php on line 26
This is my current child theme: http://pastebin.com/bK82nwQ5
I really do appreciate your support in this, especially over the weekend. I have never had an issue like this before with a child theme and it feels good to have your strong expertise behind me!
July 10, 2016 at 11:12 pm #1080772Hi there,
Thanks for updating. You can try updating the functions.php file with the following code :
<?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 // ============================================================================= <?php if ( is_user_logged_in() ) : ?> <?php $current_user = wp_get_current_user(); echo get_avatar($current_user->user_email, 100); ?> <?php else : ?> <img src="http://richtrix.com/wp-content/uploads/2016/07/Register.jpg" alt="No avatar is available" /> <?php endif; ?>
Hope this helps.
July 11, 2016 at 1:41 am #1080895Sadly this didn’t work either, see here: https://postimg.org/image/4qg2q8g7b/
This is the avatar that should change: https://postimg.org/image/iqaly4hqp/
Can’t understand why this is such a problem, hmm. Any other ideas?
July 11, 2016 at 2:12 am #1080933Hello There,
Thanks for the updates. You have it all wrong. In your first post, you mentioned that you are editing this php file here: http://pastebin.com/VuH3C1XH and that you need to change the code in line 54. Please edit that file and replace the code in line 54. The code we have corrected will not work if you will just place it in your child theme’s function.php file. It will not do anything at all. You have to place the code in the file you have indicated itself.
Hope this make sense.
July 11, 2016 at 2:15 am #1080934It makes perfect sense, thank you! I am now understanding that the changes in the parent file will be safe via the child theme edits we have made. Thank you so much for the help. I’ll try it out now.
July 11, 2016 at 2:27 am #1080947I made the appropriate changes and though the avatar changes correctly now, this error still occurs: https://postimg.org/image/4qg2q8g7b/
Please see here: http://www.richtrix.com
July 11, 2016 at 2:38 am #1080958Hello Again,
Thanks for the updates! Yes you are correct. Altering the parent theme will be overwritten when there is a parent update. It must be noted that you must place your customization in the child theme. However, the file that you are editing is in a Superfly plugin and it doesn’t have to do with the parent theme. I have already check the file and there is no way for you to change the image in it but to manually and hard code the image. I am saying that for you to accomplish what you have in mind, it is really necessary to edit that file.
Thank you for your understanding.
July 11, 2016 at 2:46 am #1080963I see. No doubt you are correct, so I have simply edited the parent file with my customization and I will just have to change it again whenever an update is released. Touch luck I guess!
Thank you once again for your team of excellent supporters! Really appreciate the fast response time and high quality expertise.
July 11, 2016 at 3:18 am #1080998You’re welcome!
Cheers!
-
AuthorPosts