Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1079552

    RichTrixcom
    Participant

    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

    #1079914

    Rue Nel
    Moderator

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

    #1080480

    RichTrixcom
    Participant

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

    #1080772

    Rupok
    Member

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

    #1080895

    RichTrixcom
    Participant

    Sadly 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?

    #1080933

    Rue Nel
    Moderator

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

    #1080934

    RichTrixcom
    Participant

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

    #1080947

    RichTrixcom
    Participant

    I 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

    #1080958

    Rue Nel
    Moderator

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

    #1080963

    RichTrixcom
    Participant

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

    #1080998

    Lely
    Moderator

    You’re welcome!

    Cheers!