Archived topic
Latest Version of PHP
20 replies · Started by David on September 11, 2019
Hello,
I received a notification from Wordpress that I need to update my site to the latest PHP version. Does the current version of GeneratePress run the latest PHP?
Thank you.
Hi there,
Yes we always make sure GP is compatible with the latest version of PHP :)
Hi Leo!
Thanks for your reply. Why does wordpress say I need to update my version of PHP then?
Thanks!
The PHP version of your site isn't related to GP.
Your hosting should be able to update that for you :)
Ok!
Thanks Leo!
No problem :)
Hello,
I had the same message from Wordpress - it said my PHP version isn't secure.So I updated to the latest version from the server side.
After upgrading, I get a gp-premium warning on all my blog posts. I had to roll it back to the 'insecure' version to get rid of the warning.
Warning: Use of undefined constant ID - assumed 'ID' (this will throw an Error in a future version of PHP) in /home/***/public_html/wp-content/plugins/gp-premium/elements/class-hooks.php(180) : eval()'d code on line 10
Please help.
Hi there,
Go to Appearance > Elements - do you have any Hooks that contain PHP? If so disable the hook by Quick Editing them and setting the status to draft.
Let us know if that resolves the error.
The only hook which I seem to have put in, is a mailchimp pop-up -- and that doesn't seem to contain PHP.
(Sorry. Non-programmer here. I tested for PHP by just checking if the letters php appeared in the hook's script. Guessing that's the right way to tell if a hook 'contains PHP'.)
The warning I mention is appearing in a single post's sidebar. And I see that there is a hook titled 'Single Post Sidebar'.
But I think this hook came as part of the GP's bold theme.
Could you edit the Single Post Sidebar element. And copy and paste the code here.
Before submitting please highlight the code and hit the CODE button. This will preserve its formatting.
<div class="author-box">
<?php
global $post;
?>
<div class="avatar"><?php echo get_avatar( get_the_author_meta( ID )); ?></div>
<h5 class="author-title"><?php printf( esc_attr__( 'About %s', 'the author' ), get_the_author_meta( 'display_name') );?></h5>
<div class="author-summary">
<p class="author-description"><?php echo wp_kses( get_the_author_meta( 'description' ), null ); ?></p>
<div class="author-links">
<a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>" title="Read more">
Read more of my posts.
</a>
</div>
</div>
</div>
Hoping that the code copy-pasting worked.
<div class="avatar"><?php echo get_avatar( get_the_author_meta( ID )); ?></div>
I suspect this line to be throwing the warning. Because the warning appears right above the 'Author-title' in the sidebar for the single post page... I could be wrong.
Edit: And I just realized this is 'line 10' of the hook's script, and the warning mentions line 10. So probably more likely it's this.
Try replacing the code with:
<div class="author-box">
<div class="avatar">
<?php
global $post;
$author_id = $post->post_author;
echo get_avatar( $author_id );
?>
</div>
<h5 class="author-title">
<?php printf( esc_attr__( 'About %s', 'the author' ), get_the_author_meta( 'display_name') );?>
</h5>
<div class="author-summary">
<p class="author-description"><?php echo wp_kses( get_the_author_meta( 'description' ), null ); ?></p>
<div class="author-links">
<a href="<?php echo get_author_posts_url( get_the_author_meta( $author_id ) ); ?>" title="Read more">Read more of my posts.</a>
</div>
</div>
</div>
Thank you David. That seems to have worked.
Thanks for testing - we'll get the Site Library updated.